RFR [9] 7150539: HttpURLConnection.getResponseMessage() doesn't throw IOException on server error (OS X)

Chris Hegarty chris.hegarty at oracle.com
Fri Jan 31 02:52:34 PST 2014


This is a trivial test only change to make it agnostic of system proxy 
setting on OS X. The test requires that it makes a direct connection to 
the self contained trivial test HTTP server, it should not be influenced 
by system proxy settings.

diff --git a/test/sun/net/www/http/HttpClient/RetryPost.java 
b/test/sun/net/www/http/HttpClient/RetryPost.java
--- a/test/sun/net/www/http/HttpClient/RetryPost.java
+++ b/test/sun/net/www/http/HttpClient/RetryPost.java
@@ -55,8 +55,8 @@
      void doClient() {
          try {
              InetSocketAddress address = httpServer.getAddress();
-            URL url = new URL("http://" + address.getHostName() + ":" + 
address.getPort() + "/test/");
-            HttpURLConnection uc = (HttpURLConnection)url.openConnection();
+            URL url = new URL("http://localhost:" + address.getPort() + 
"/test/");
+            HttpURLConnection uc = 
(HttpURLConnection)url.openConnection(Proxy.NO_PROXY);
              uc.setDoOutput(true);
              uc.setRequestMethod("POST");
              uc.getResponseCode();

-Chris.


More information about the net-dev mailing list