publicstaticvoid main(String[] args) { for (TestCase t : emptyNonProxiesHosts()) t.run(); for (TestCase t : nonEmptyNonProxiesHosts()) t.run(); for (TestCase t : misc()) t.run();
}
// Setting http.nonProxyHosts to an empty string has an effect of // not including default hosts to the list of exceptions // (i.e. if you want everything to be connected directly rather than // through proxy, you should set this property to an empty string) privatestatic Collection<TestCase> emptyNonProxiesHosts() {
List<TestCase> tests = new LinkedList<>();
String[] loopbacks = {"localhost", "[::1]", "[::0]", "0.0.0.0", "127.0.0.0", "127.0.0.1", "127.0.1.0", "127.0.1.1", "127.1.0.0", "127.1.0.1", "127.1.1.0", "127.1.1.1"};
Map<String, String> properties = new HashMap<>();
properties.put("http.proxyHost", "http://proxy.example.com");
properties.put("http.nonProxyHosts", ""); for (String s : loopbacks) {
tests.add(new TestCase(properties, "http://" + s, true));
} return tests;
}
// No matter what is set into the http.nonProxyHosts (as far as it is not // an empty string) loopback address aliases must be always connected // directly privatestatic Collection<TestCase> nonEmptyNonProxiesHosts() {
List<TestCase> tests = new LinkedList<>();
String[] nonProxyHosts = { "google.com", "localhost", "[::1]", "[::0]", "0.0.0.0", "127.0.0.0", "127.0.0.1", "127.0.1.0", "127.0.1.1", "127.1.0.0", "127.1.0.1", "127.1.1.0", "127.1.1.1"};
String[] loopbacks = {"localhost", "[::1]", "[::0]", "0.0.0.0", "127.0.0.0", "127.0.0.1", "127.0.1.0", "127.0.1.1", "127.1.0.0", "127.1.0.1", "127.1.1.0", "127.1.1.1"}; for (String h : nonProxyHosts) { for (String s : loopbacks) {
Map<String, String> properties = new HashMap<>();
properties.put("http.proxyHost", "http://proxy.example.com");
properties.put("http.nonProxyHosts", h);
tests.add(new TestCase(properties, "http://" + s, false));
}
} return tests;
}
// unsorted tests privatestatic Collection<TestCase> misc() {
List<TestCase> t = new LinkedList<>();
t.add(new TestCase("oracle.com", "http://137.254.16.101", true));
t.add(new TestCase("google.com", "http://74.125.200.101", true));
if (actualProxying != expectedProxying) thrownew AssertionError(String.format( "Expected %s connection for %s (given " + "properties=%s). Here's the list of proxies " + "returned: %s",
expectedProxying ? "proxied" : "direct", urlhost,
localProperties, proxies
));
}
}
}
Messung V0.5 in Prozent
¤ 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.8Bemerkung:
(vorverarbeitet am 2026-09-29)
¤
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.