am 45b98832: Merge "Fix URLConnectionTest#testConnectTimeouts."
* commit '45b98832876c9ce29952c9b4fe253a65f37f3790':
Fix URLConnectionTest#testConnectTimeouts.
diff --git a/luni/src/test/java/libcore/java/net/URLConnectionTest.java b/luni/src/test/java/libcore/java/net/URLConnectionTest.java
index d39e39f..be549ed 100644
--- a/luni/src/test/java/libcore/java/net/URLConnectionTest.java
+++ b/luni/src/test/java/libcore/java/net/URLConnectionTest.java
@@ -1641,9 +1641,12 @@
* addresses. This is typically one IPv4 address and one IPv6 address.
*/
public void testConnectTimeouts() throws IOException {
- StuckServer ss = new StuckServer(false);
+ StuckServer ss = new StuckServer(true);
int serverPort = ss.getLocalPort();
- URLConnection urlConnection = new URL("http://localhost:" + serverPort).openConnection();
+ String hostName = ss.getLocalSocketAddress().getAddress().getHostAddress();
+ URLConnection urlConnection = new URL("http://" + hostName + ":" + serverPort + "/")
+ .openConnection();
+
int timeout = 1000;
urlConnection.setConnectTimeout(timeout);
long start = System.currentTimeMillis();