jdk/test/sun/net/www/protocol/https/NewImpl/ComHostnameVerifier.java
changeset 29097 01a70c01f5a1
parent 23052 241885315119
child 30820 0d4717a011d3
--- a/jdk/test/sun/net/www/protocol/https/NewImpl/ComHostnameVerifier.java	Mon Feb 23 11:37:36 2015 +0100
+++ b/jdk/test/sun/net/www/protocol/https/NewImpl/ComHostnameVerifier.java	Mon Feb 23 15:48:20 2015 +0000
@@ -186,6 +186,17 @@
         }
     }
 
+    private static class ComSunHTTPSHandlerFactory implements URLStreamHandlerFactory {
+        private static String SUPPORTED_PROTOCOL = "https";
+
+        public URLStreamHandler createURLStreamHandler(String protocol) {
+            if (!protocol.equalsIgnoreCase(SUPPORTED_PROTOCOL))
+                return null;
+
+            return new com.sun.net.ssl.internal.www.protocol.https.Handler();
+        }
+    }
+
     /*
      * Define the client side of the test.
      *
@@ -200,8 +211,7 @@
             Thread.sleep(50);
         }
 
-        System.setProperty("java.protocol.handler.pkgs",
-            "com.sun.net.ssl.internal.www.protocol");
+        URL.setURLStreamHandlerFactory(new ComSunHTTPSHandlerFactory());
 
         System.setProperty("https.cipherSuites",
                 "SSL_DH_anon_WITH_3DES_EDE_CBC_SHA");