8006669: sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh fails on mac
Reviewed-by: alanb
--- a/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.java Wed Jan 23 15:06:49 2013 +0400
+++ b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.java Wed Jan 23 14:45:44 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/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.java Wed Jan 23 15:06:49 2013 +0400
+++ b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.java Wed Jan 23 14:45:44 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());
}
}
-
-
}