RFR: JDK-8129507 - sun/net/www/protocol/http/B6369510.java fails intermittently

Mark Sheppard mark.sheppard at oracle.com
Wed Jun 24 15:34:48 UTC 2015


Hi
    Please oblige and review the change below
which addresses the issue
https://bugs.openjdk.java.net/browse/JDK-8129507

This amends the url.openConnection() to take the Proxy.NO_PROXY argument,
so that a direct connection is made to test http server, thus bypassing 
any configured and enabled
http proxies on mac OS.

regards
Mark

-------------------------- changeset -------------------

diff -r 9a66ca9b7e36 test/sun/net/www/protocol/http/B6369510.java
--- a/test/sun/net/www/protocol/http/B6369510.java      Tue Jun 23 
14:20:59 2015 -0700
+++ b/test/sun/net/www/protocol/http/B6369510.java      Wed Jun 24 
13:00:49 2015 +0100
@@ -63,7 +63,7 @@

              // GET Request
              URL url = new URL("http://" + 
InetAddress.getLocalHost().getHostName() + ":" + address.getPort() + 
"/test/");
-            HttpURLConnection uc = (HttpURLConnection)url.openConnection();
+            HttpURLConnection uc = 
(HttpURLConnection)url.openConnection(Proxy.NO_PROXY);
              int resp = uc.getResponseCode();
              if (resp != 200)
                  throw new RuntimeException("Failed: Response code from 
GET is not 200 RSP == " + resp);
@@ -71,7 +71,7 @@
              System.out.println("Response code from GET = 200 OK");

              //POST Request
-            uc = (HttpURLConnection)url.openConnection();
+            uc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY);
              uc.setDoOutput(true);
              uc.setRequestMethod("POST");
              OutputStream os = uc.getOutputStream();




More information about the net-dev mailing list