// for non existing proxy expect an IOException try {
InetSocketAddress isa = InetSocketAddress.createUnresolved("inexistent", 8080);
Proxy proxy = new Proxy(Proxy.Type.HTTP, isa);
HttpURLConnection urlc = (HttpURLConnection)url.openConnection (proxy);
InputStream is = urlc.getInputStream ();
is.close(); thrownew RuntimeException("non existing per connection proxy should lead to IOException");
} catch (IOException ioex) { // expected
} // for NO_PROXY, expect direct connection try {
HttpURLConnection urlc = (HttpURLConnection)url.openConnection (Proxy.NO_PROXY); int respCode = urlc.getResponseCode();
urlc.disconnect();
} catch (IOException ioex) { thrownew RuntimeException("direct connection should succeed :"+ioex.getMessage());
} // for a normal proxy setting expect to see connection // goes through that proxy try {
InetSocketAddress isa = InetSocketAddress.createUnresolved(
loopbackAddress.getHostAddress(),
pserver.getPort());
Proxy p = new Proxy(Proxy.Type.HTTP, isa);
HttpURLConnection urlc = (HttpURLConnection)url.openConnection (p); int respCode = urlc.getResponseCode();
urlc.disconnect();
} catch (IOException ioex) { thrownew RuntimeException("connection through a local proxy should succeed :"+ioex.getMessage());
}
publicvoid run() { int BUFFER_SIZE = 400; byte[] buf = newbyte[BUFFER_SIZE]; int bytesRead = 0; int count = 0; // keep track of the amount of data transfer
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.12Bemerkung:
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.