8270553: Tests should not use (real, in-use, routable) 1.1.1.1 as dummy IP value

Reviewed-by: shade, dfuchs
This commit is contained in:
Jonathan Dowland 2021-09-14 17:12:49 +00:00 committed by Daniel Fuchs
parent 0f31d0fb2c
commit 394ebc8642

View File

@ -55,7 +55,8 @@ public class HttpURLConWithProxy {
// Remove the default nonProxyHosts to use localhost for testing
System.setProperty("http.nonProxyHosts", "");
System.setProperty("http.proxyHost", "1.1.1.1");
// 240.0.0.0/4 is unallocated and "reserved for future use" (RFC 1112, Section 4)
System.setProperty("http.proxyHost", "240.0.0.1");
System.setProperty("http.proxyPort", "1111");
// Use the logger to help verify the Proxy was used
@ -131,8 +132,9 @@ class MyProxySelector extends ProxySelector {
List<Proxy> proxies = new ArrayList<>();
MyProxySelector() {
Proxy p1 = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("2.2.2.2", 2222));
Proxy p2 = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("3.3.3.3", 3333));
// 240.0.0.0/4 is unallocated and "reserved for future use" (RFC 1112, Section 4)
Proxy p1 = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("240.0.0.2", 2222));
Proxy p2 = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("240.0.0.3", 3333));
proxies.add(p1);
proxies.add(p2);
}