test/sun/net/www/protocol/https/NewImpl/ComHTTPSConnection.java

Print this page

        

*** 186,195 **** --- 186,206 ---- sslSocket.close(); serverReady = false; } } + 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. * * If the server prematurely exits, serverReady will be set to true * to avoid infinite hangs.
*** 203,214 **** } HostnameVerifier reservedHV = HttpsURLConnection.getDefaultHostnameVerifier(); try { ! System.setProperty("java.protocol.handler.pkgs", ! "com.sun.net.ssl.internal.www.protocol"); HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier()); URL url = new URL("https://" + "localhost:" + serverPort + "/etc/hosts"); URLConnection urlc = url.openConnection(); --- 214,224 ---- } HostnameVerifier reservedHV = HttpsURLConnection.getDefaultHostnameVerifier(); try { ! URL.addURLStreamHandlerFactory(new ComSunHTTPSHandlerFactory()); HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier()); URL url = new URL("https://" + "localhost:" + serverPort + "/etc/hosts"); URLConnection urlc = url.openConnection();