changeset 5738:57b08de34688

Merge
author coffeys
date Fri, 08 Feb 2013 17:51:31 +0000
parents 3e82e2c9b4e7 47a55dc371a5
children 19db25f92f6e
files
diffstat 2 files changed, 11 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.java	Fri Feb 08 15:05:00 2013 +0100
+++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.java	Fri Feb 08 17:51:31 2013 +0000
@@ -153,7 +153,7 @@
             /*
              * setup up a proxy
              */
-            setupProxy();
+            SocketAddress pAddr = setupProxy();
 
             /*
              * we want to avoid URLspoofCheck failures in cases where the cert
@@ -163,7 +163,8 @@
                                           new NameVerifier());
             URL url = new URL("https://" + hostname+ ":" + serverPort);
 
-            HttpsURLConnection https = (HttpsURLConnection)url.openConnection();
+            Proxy p = new Proxy(Proxy.Type.HTTP, pAddr);
+            HttpsURLConnection https = (HttpsURLConnection)url.openConnection(p);
             https.setDoOutput(true);
             https.setRequestMethod("POST");
             PrintStream ps = null;
@@ -200,14 +201,12 @@
         }
     }
 
-    static void setupProxy() throws IOException {
+    static SocketAddress setupProxy() throws IOException {
         ProxyTunnelServer pserver = new ProxyTunnelServer();
 
         // disable proxy authentication
         pserver.needUserAuth(false);
         pserver.start();
-        System.setProperty("https.proxyHost", "localhost");
-        System.setProperty("https.proxyPort", String.valueOf(
-                                        pserver.getPort()));
+        return new InetSocketAddress("localhost", pserver.getPort());
     }
 }
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.java	Fri Feb 08 15:05:00 2013 +0100
+++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.java	Fri Feb 08 17:51:31 2013 +0000
@@ -152,7 +152,7 @@
         /*
          * setup up a proxy
          */
-        setupProxy();
+        SocketAddress pAddr = setupProxy();
 
         /*
          * we want to avoid URLspoofCheck failures in cases where the cert
@@ -162,7 +162,8 @@
                                       new NameVerifier());
         URL url = new URL("https://" + hostname + ":" + serverPort);
 
-        HttpsURLConnection https = (HttpsURLConnection)url.openConnection();
+        Proxy p = new Proxy(Proxy.Type.HTTP, pAddr);
+        HttpsURLConnection https = (HttpsURLConnection)url.openConnection(p);
         https.setDoOutput(true);
         https.setRequestMethod("POST");
         PrintStream ps = null;
@@ -195,7 +196,7 @@
         }
     }
 
-    static void setupProxy() throws IOException {
+    static SocketAddress setupProxy() throws IOException {
         ProxyTunnelServer pserver = new ProxyTunnelServer();
 
         /*
@@ -209,9 +210,8 @@
         pserver.setUserAuth("Test", "test123");
 
         pserver.start();
-        System.setProperty("https.proxyHost", "localhost");
-        System.setProperty("https.proxyPort", String.valueOf(
-                                        pserver.getPort()));
+
+        return new InetSocketAddress("localhost", pserver.getPort());
     }
 
     public static class TestAuthenticator extends Authenticator {
@@ -220,6 +220,4 @@
                                          "test123".toCharArray());
         }
     }
-
-
 }