8223632: Replace wildcard address with loopback or local host in tests - part 5

Replaces wildcard usage by loopback, when possible, adds intermittent keyword and a comment, when not.

Reviewed-by: chegar
This commit is contained in:
Daniel Fuchs 2019-05-13 17:31:23 +01:00
parent 4a59b995da
commit 3103d346a7
9 changed files with 131 additions and 53 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,9 +23,12 @@
/* @test /* @test
* @bug 4924226 * @bug 4924226
* @summary PIT: Can no launch jnlp application via 127.0.0.1 address on the web server * @key intermittent
* @summary PIT: Can no launch jnlp application via 127.0.0.1 address on the web server.
* This test might fail intermittently as it needs a server that
* binds to the wildcard address.
* @modules java.base/sun.net.www * @modules java.base/sun.net.www
* @library ../../../sun/net/www/httptest/ * @library ../../../sun/net/www/httptest/ /test/lib
* @build ClosedChannelList TestHttpServer HttpTransaction HttpCallback * @build ClosedChannelList TestHttpServer HttpTransaction HttpCallback
* @compile LoopbackAddresses.java * @compile LoopbackAddresses.java
* @run main/othervm LoopbackAddresses * @run main/othervm LoopbackAddresses
@ -33,6 +36,7 @@
import java.net.*; import java.net.*;
import java.io.*; import java.io.*;
import jdk.test.lib.net.URIBuilder;
/** /**
* Our default proxy selector should bypass localhost and loopback * Our default proxy selector should bypass localhost and loopback
@ -53,12 +57,18 @@ public class LoopbackAddresses implements HttpCallback {
public static void main(String[] args) { public static void main(String[] args) {
try { try {
InetAddress loopback = InetAddress.getLoopbackAddress();
// This server needs to bind to the wildcard address as we want it
// to answer both for the loopback and "localhost".
// Though "localhost" usually point to the loopback there is no
// hard guarantee.
server = new TestHttpServer (new LoopbackAddresses(), 1, 10, 0); server = new TestHttpServer (new LoopbackAddresses(), 1, 10, 0);
ProxyServer pserver = new ProxyServer(InetAddress.getByName("localhost"), server.getLocalPort()); ProxyServer pserver = new ProxyServer(InetAddress.getByName("localhost"), server.getLocalPort());
// start proxy server // start proxy server
new Thread(pserver).start(); new Thread(pserver).start();
System.setProperty("http.proxyHost", "localhost"); System.setProperty("http.proxyHost", loopback.getHostAddress());
System.setProperty("http.proxyPort", pserver.getPort()+""); System.setProperty("http.proxyPort", pserver.getPort()+"");
URL url = new URL("http://localhost:"+server.getLocalPort()); URL url = new URL("http://localhost:"+server.getLocalPort());
@ -72,7 +82,11 @@ public class LoopbackAddresses implements HttpCallback {
} }
try { try {
url = new URL("http://127.0.0.1:"+server.getLocalPort()); url = URIBuilder.newBuilder()
.scheme("http")
.host(loopback.getHostAddress())
.port(server.getLocalPort())
.toURL();
HttpURLConnection urlc = (HttpURLConnection)url.openConnection (); HttpURLConnection urlc = (HttpURLConnection)url.openConnection ();
int respCode = urlc.getResponseCode(); int respCode = urlc.getResponseCode();
urlc.disconnect(); urlc.disconnect();
@ -104,7 +118,8 @@ public class LoopbackAddresses implements HttpCallback {
public ProxyServer(InetAddress server, int port) throws IOException { public ProxyServer(InetAddress server, int port) throws IOException {
serverInetAddr = server; serverInetAddr = server;
serverPort = port; serverPort = port;
ss = new ServerSocket(0); ss = new ServerSocket();
ss.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
} }
public void run() { public void run() {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 4696512 * @bug 4696512
* @summary HTTP client: Improve proxy server configuration and selection * @summary HTTP client: Improve proxy server configuration and selection
* @modules java.base/sun.net.www * @modules java.base/sun.net.www
* @library ../../../sun/net/www/httptest/ * @library ../../../sun/net/www/httptest/ /test/lib
* @build ClosedChannelList TestHttpServer HttpTransaction HttpCallback * @build ClosedChannelList TestHttpServer HttpTransaction HttpCallback
* @compile ProxyTest.java * @compile ProxyTest.java
* @run main/othervm -Dhttp.proxyHost=inexistant -Dhttp.proxyPort=8080 ProxyTest * @run main/othervm -Dhttp.proxyHost=inexistant -Dhttp.proxyPort=8080 ProxyTest
@ -35,6 +35,7 @@
import java.net.*; import java.net.*;
import java.io.*; import java.io.*;
import java.util.ArrayList; import java.util.ArrayList;
import jdk.test.lib.net.URIBuilder;
public class ProxyTest implements HttpCallback { public class ProxyTest implements HttpCallback {
static TestHttpServer server; static TestHttpServer server;
@ -52,8 +53,8 @@ public class ProxyTest implements HttpCallback {
} }
static public class MyProxySelector extends ProxySelector { static public class MyProxySelector extends ProxySelector {
private ProxySelector def = null; private static volatile URI lastURI;
private ArrayList<Proxy> noProxy; private final ArrayList<Proxy> noProxy;
public MyProxySelector() { public MyProxySelector() {
noProxy = new ArrayList<Proxy>(1); noProxy = new ArrayList<Proxy>(1);
@ -61,13 +62,16 @@ public class ProxyTest implements HttpCallback {
} }
public java.util.List<Proxy> select(URI uri) { public java.util.List<Proxy> select(URI uri) {
System.out.println("Selecting no proxy for " + uri);
lastURI = uri;
return noProxy; return noProxy;
} }
public void connectFailed(URI uri, SocketAddress sa, IOException ioe) { public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {
} }
}
public static URI lastURI() { return lastURI; }
}
public static void main(String[] args) { public static void main(String[] args) {
ProxySelector defSelector = ProxySelector.getDefault(); ProxySelector defSelector = ProxySelector.getDefault();
@ -75,12 +79,21 @@ public class ProxyTest implements HttpCallback {
throw new RuntimeException("Default ProxySelector is null"); throw new RuntimeException("Default ProxySelector is null");
ProxySelector.setDefault(new MyProxySelector()); ProxySelector.setDefault(new MyProxySelector());
try { try {
InetAddress loopback = InetAddress.getLoopbackAddress();
server = new TestHttpServer (new ProxyTest(), 1, 10, 0); server = new TestHttpServer (new ProxyTest(), 1, 10, 0);
URL url = new URL("http://localhost:"+server.getLocalPort()); URL url = URIBuilder.newBuilder()
.scheme("http")
.loopback()
.port(server.getLocalPort())
.toURL();
System.out.println ("client opening connection to: " + url); System.out.println ("client opening connection to: " + url);
HttpURLConnection urlc = (HttpURLConnection)url.openConnection (); HttpURLConnection urlc = (HttpURLConnection)url.openConnection ();
InputStream is = urlc.getInputStream (); InputStream is = urlc.getInputStream ();
is.close(); is.close();
URI lastURI = MyProxySelector.lastURI();
if (!String.valueOf(lastURI).equals(url + "/")) {
throw new AssertionError("Custom proxy was not used: last URI was " + lastURI);
}
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} finally { } finally {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
/** /**
* @test * @test
* @bug 6181108 * @bug 6181108
* @library /test/lib
* @summary double encoded URL passed to ResponseCache * @summary double encoded URL passed to ResponseCache
* @author Edward Wang * @author Edward Wang
*/ */
@ -31,7 +32,7 @@
import java.net.*; import java.net.*;
import java.util.*; import java.util.*;
import java.io.*; import java.io.*;
import jdk.test.lib.net.URIBuilder;
public class B6181108 implements Runnable { public class B6181108 implements Runnable {
ServerSocket ss; ServerSocket ss;
@ -44,7 +45,7 @@ public class B6181108 implements Runnable {
try { try {
Socket s = ss.accept(); Socket s = ss.accept();
InputStream is = s.getInputStream (); InputStream is = s.getInputStream();
BufferedReader r = new BufferedReader(new InputStreamReader(is)); BufferedReader r = new BufferedReader(new InputStreamReader(is));
String x; String x;
while ((x=r.readLine()) != null) { while ((x=r.readLine()) != null) {
@ -75,32 +76,38 @@ public class B6181108 implements Runnable {
} }
static class ResponseCache extends java.net.ResponseCache { static class ResponseCache extends java.net.ResponseCache {
public CacheResponse get (URI uri, String method, Map<String,List<String>> hdrs) { public CacheResponse get(URI uri, String method, Map<String,List<String>> hdrs) {
System.out.println ("get uri = " + uri); System.out.println("get uri = " + uri);
if (!urlWithSpace.equals(uri.toString())) { if (!urlWithSpace.equals(uri.toString())) {
throw new RuntimeException("test failed"); throw new RuntimeException("test failed");
} }
return null; return null;
} }
public CacheRequest put (URI uri, URLConnection urlc) { public CacheRequest put(URI uri, URLConnection urlc) {
System.out.println ("put uri = " + uri); System.out.println("put uri = " + uri);
return null; return null;
} }
} }
B6181108() throws Exception { B6181108() throws Exception {
/* start the server */ /* start the server */
ss = new ServerSocket(0); InetAddress loopback = InetAddress.getLoopbackAddress();
ss = new ServerSocket();
ss.bind(new InetSocketAddress(loopback, 0));
(new Thread(this)).start(); (new Thread(this)).start();
ResponseCache.setDefault (new ResponseCache()); ResponseCache.setDefault(new ResponseCache());
urlWithSpace = "http://localhost:" + String base = URIBuilder.newBuilder()
Integer.toString(ss.getLocalPort()) + .scheme("http")
"/space%20test/page1.html"; .loopback()
URL url = new URL (urlWithSpace); .port(ss.getLocalPort())
.build()
.toString();
urlWithSpace = base + "/space%20test/page1.html";
URL url = new URL(urlWithSpace);
URLConnection urlc = url.openConnection(); URLConnection urlc = url.openConnection();
int i = ((HttpURLConnection)(urlc)).getResponseCode(); int i = ((HttpURLConnection)(urlc)).getResponseCode();
System.out.println ("response code = " + i); System.out.println("response code = " + i);
ResponseCache.setDefault(null); ResponseCache.setDefault(null);
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -51,7 +51,8 @@ public class SocketClosedException {
} }
static void doClientSide(int port) throws Exception { static void doClientSide(int port) throws Exception {
Socket socket = new Socket("localhost", port); InetAddress loopback = InetAddress.getLoopbackAddress();
Socket socket = new Socket(loopback, port);
InputStream is = socket.getInputStream(); InputStream is = socket.getInputStream();
is.read(); is.read();
@ -64,7 +65,9 @@ public class SocketClosedException {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
IPSupport.throwSkippedExceptionIfNonOperational(); IPSupport.throwSkippedExceptionIfNonOperational();
serverSocket = new ServerSocket(0); InetAddress loopback = InetAddress.getLoopbackAddress();
serverSocket = new ServerSocket();
serverSocket.bind(new InetSocketAddress(loopback, 0));
startServer(); startServer();
try { try {
doClientSide(serverSocket.getLocalPort()); doClientSide(serverSocket.getLocalPort());

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,7 +24,10 @@
/* /*
* @test * @test
* @bug 8047031 * @bug 8047031
* @summary SocketPermission tests for legacy socket types * @key intermittent
* @summary SocketPermission tests for legacy socket types.
* This test needs to bind its servers to the wildcard
* address and as such may fail intermittently.
* @library /test/lib * @library /test/lib
* @build jdk.test.lib.NetworkConfiguration * @build jdk.test.lib.NetworkConfiguration
* jdk.test.lib.Platform * jdk.test.lib.Platform

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
/** /**
* @test * @test
* @bug 4774503 * @bug 4774503
* @library /test/lib
* @summary Calling HttpURLConnection's disconnect method after the * @summary Calling HttpURLConnection's disconnect method after the
* response has been received causes havoc with persistent * response has been received causes havoc with persistent
* connections. * connections.
@ -31,6 +32,9 @@
import java.net.*; import java.net.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import jdk.test.lib.net.URIBuilder;
public class DisconnectAfterEOF { public class DisconnectAfterEOF {
@ -239,13 +243,18 @@ public class DisconnectAfterEOF {
public static void main(String args[]) throws Exception { public static void main(String args[]) throws Exception {
// start server // start server
ServerSocket ss = new ServerSocket(0); InetAddress loopback = InetAddress.getLoopbackAddress();
ServerSocket ss = new ServerSocket();
ss.bind(new InetSocketAddress(loopback, 0));
Server svr = new Server(ss); Server svr = new Server(ss);
svr.start(); svr.start();
String uri = "http://localhost:" + String uri = URIBuilder.newBuilder()
Integer.toString(ss.getLocalPort()) + .scheme("http")
"/foo.html"; .loopback()
.port(ss.getLocalPort())
.path("/foo.html")
.build().toString();
/* /*
* The following is the test scenario we create here :- * The following is the test scenario we create here :-

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
/* @test /* @test
* @bug 4191147 * @bug 4191147
* @summary 1.2beta4 does not load user defined content handlers * @summary 1.2beta4 does not load user defined content handlers
* @library /test/lib
* @build UserContentHandler * @build UserContentHandler
* @run main/othervm UserContentHandler * @run main/othervm UserContentHandler
*/ */
@ -38,6 +39,7 @@
import java.net.*; import java.net.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import jdk.test.lib.net.URIBuilder;
public class UserContentHandler implements Runnable { public class UserContentHandler implements Runnable {
@ -74,7 +76,9 @@ public class UserContentHandler implements Runnable {
UserContentHandler() throws Exception { UserContentHandler() throws Exception {
ss = new ServerSocket(0); InetAddress loopback = InetAddress.getLoopbackAddress();
ss = new ServerSocket();
ss.bind(new InetSocketAddress(loopback, 0));
Thread thr = new Thread(this); Thread thr = new Thread(this);
thr.start(); thr.start();
@ -87,8 +91,13 @@ public class UserContentHandler implements Runnable {
props.put("java.content.handler.pkgs", "COM.foo.content"); props.put("java.content.handler.pkgs", "COM.foo.content");
System.setProperties(props); System.setProperties(props);
URL u = new URL("http://localhost:" + ss.getLocalPort() + URL u = URIBuilder.newBuilder()
"/anything.txt"); .scheme("http")
.loopback()
.port(ss.getLocalPort())
.path("/anything.txt")
.toURL();
if (!(u.openConnection().getContent() instanceof String)) { if (!(u.openConnection().getContent() instanceof String)) {
throw new RuntimeException("Load user defined content handler failed."); throw new RuntimeException("Load user defined content handler failed.");
} else { } else {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -26,11 +26,13 @@ import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.*; import java.net.*;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import jdk.test.lib.net.URIBuilder;
/* /*
* @test * @test
* @bug 7025238 * @bug 7025238
* @modules jdk.httpserver * @modules jdk.httpserver
* @library /test/lib
* @summary HttpURLConnection does not handle URLs with an empty path component * @summary HttpURLConnection does not handle URLs with an empty path component
*/ */
public class B7025238 { public class B7025238 {
@ -44,7 +46,13 @@ public class B7025238 {
try { try {
s = new Server(); s = new Server();
s.startServer(); s.startServer();
URL url = new URL("http://localhost:" + s.getPort() + "?q=test"); URL url = URIBuilder.newBuilder()
.scheme("http")
.loopback()
.port(s.getPort())
.query("q=test")
.toURL();
System.out.println("Connecting to: " + url);
HttpURLConnection urlConnection = (HttpURLConnection)url.openConnection(); HttpURLConnection urlConnection = (HttpURLConnection)url.openConnection();
urlConnection.setRequestMethod("GET"); urlConnection.setRequestMethod("GET");
urlConnection.connect(); urlConnection.connect();
@ -62,7 +70,8 @@ public class B7025238 {
HttpServer server; HttpServer server;
public void startServer() { public void startServer() {
InetSocketAddress addr = new InetSocketAddress(0); InetAddress loopback = InetAddress.getLoopbackAddress();
InetSocketAddress addr = new InetSocketAddress(loopback, 0);
try { try {
server = HttpServer.create(addr, 0); server = HttpServer.create(addr, 0);
} catch (IOException ioe) { } catch (IOException ioe) {
@ -101,4 +110,3 @@ public class B7025238 {
} }
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -26,12 +26,14 @@
* @bug 6498566 * @bug 6498566
* @summary URL.openConnection(Proxy.NO_PROXY) may connect through a proxy. * @summary URL.openConnection(Proxy.NO_PROXY) may connect through a proxy.
* @modules java.base/sun.net.www * @modules java.base/sun.net.www
* @library /test/lib
* @run main/othervm ProxyFromCache * @run main/othervm ProxyFromCache
*/ */
import java.net.*; import java.net.*;
import java.io.*; import java.io.*;
import sun.net.www.MessageHeader; import sun.net.www.MessageHeader;
import jdk.test.lib.net.URIBuilder;
/* Creates a simple proxy and http server that just return 200 OK. /* Creates a simple proxy and http server that just return 200 OK.
* Open a URL pointing to the http server and specify that the * Open a URL pointing to the http server and specify that the
@ -43,18 +45,21 @@ import sun.net.www.MessageHeader;
public class ProxyFromCache public class ProxyFromCache
{ {
public static void main(String[] args) { public static void main(String[] args) throws Exception {
ServerSocket proxySSocket, httpSSocket; ServerSocket proxySSocket, httpSSocket;
int proxyPort, httpPort; int proxyPort, httpPort;
InetAddress loopback = InetAddress.getLoopbackAddress();
try { try {
proxySSocket = new ServerSocket(0); proxySSocket = new ServerSocket();
proxySSocket.bind(new InetSocketAddress(loopback, 0));
proxyPort = proxySSocket.getLocalPort(); proxyPort = proxySSocket.getLocalPort();
httpSSocket = new ServerSocket(0); httpSSocket = new ServerSocket();
httpSSocket.bind(new InetSocketAddress(loopback, 0));
httpPort = httpSSocket.getLocalPort(); httpPort = httpSSocket.getLocalPort();
} catch (Exception e) { } catch (Exception e) {
System.out.println ("Exception: " + e); System.out.println ("Exception: " + e);
return; throw e;
} }
SimpleServer proxyServer = new SimpleServer(proxySSocket); SimpleServer proxyServer = new SimpleServer(proxySSocket);
@ -62,12 +67,18 @@ public class ProxyFromCache
SimpleServer httpServer = new SimpleServer(httpSSocket); SimpleServer httpServer = new SimpleServer(httpSSocket);
httpServer.start(); httpServer.start();
InetSocketAddress addr = new InetSocketAddress("localhost", proxyPort); InetSocketAddress addr = new InetSocketAddress(loopback, proxyPort);
Proxy proxy = new Proxy(Proxy.Type.HTTP, addr); Proxy proxy = new Proxy(Proxy.Type.HTTP, addr);
try { try {
String urlStr = "http://localhost:" + httpPort + "/"; URL url = URIBuilder.newBuilder()
URL url = new URL(urlStr); .scheme("http")
.loopback()
.port(httpPort)
.path("/")
.toURL();
String urlStr = url.toString();
// 1st connection. // 1st connection.
HttpURLConnection uc = (HttpURLConnection) url.openConnection(proxy); HttpURLConnection uc = (HttpURLConnection) url.openConnection(proxy);
@ -100,7 +111,7 @@ public class ProxyFromCache
throw new RuntimeException("Failed: Proxy being sent " + proxyCount + " requests"); throw new RuntimeException("Failed: Proxy being sent " + proxyCount + " requests");
} }
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw e;
} }
} }
} }