harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r935201 - /harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
Date Sat, 17 Apr 2010 16:31:52 GMT
Author: hindessm
Date: Sat Apr 17 16:31:52 2010
New Revision: 935201

URL: http://svn.apache.org/viewvc?rev=935201&view=rev
Log:
Applying patches from "[#HARMONY-6500] [classlib][luni]
HttpURLConnectionTest.testUsingProxy2 doesn't throw ConnectException when
port is already in use".

Modified:
    harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java

Modified: harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java?rev=935201&r1=935200&r2=935201&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
Sat Apr 17 16:31:52 2010
@@ -437,13 +437,18 @@ public class HttpURLConnectionTest exten
             urlConnect.getInputStream();
             assertTrue(urlConnect.usingProxy());
             
-            System.setProperty("http.proxyPort", "81");
+            // find a free port
+            ServerSocket serverSocket = new ServerSocket(0);
+            int port = serverSocket.getLocalPort();
+            serverSocket.close();
+            
+            System.setProperty("http.proxyPort", port + "");
             url = new URL(jettyURL);
             urlConnect = (HttpURLConnection) url.openConnection();
             urlConnect.getInputStream();
             assertFalse(urlConnect.usingProxy());
             
-            url = new URL("http://localhost");
+            url = new URL("http://localhost:" + port);
             urlConnect = (HttpURLConnection) url.openConnection();
             try {
                 urlConnect.getInputStream();



Mime
View raw message