test/javax/net/ssl/FixingJavadocs/ComURLNulls.java
Print this page
*** 44,59 ****
* Tests that the com null argument changes made it in ok.
*/
public class ComURLNulls {
public static void main(String[] args) throws Exception {
HostnameVerifier reservedHV =
HttpsURLConnection.getDefaultHostnameVerifier();
try {
! System.setProperty("java.protocol.handler.pkgs",
! "com.sun.net.ssl.internal.www.protocol");
/**
* This test does not establish any connection to the specified
* URL, hence a dummy URL is used.
*/
URL foobar = new URL("https://example.com/");
--- 44,70 ----
* Tests that the com null argument changes made it in ok.
*/
public class ComURLNulls {
+ 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();
+ }
+ }
+
public static void main(String[] args) throws Exception {
HostnameVerifier reservedHV =
HttpsURLConnection.getDefaultHostnameVerifier();
try {
! URL.addURLStreamHandlerFactory(new ComSunHTTPSHandlerFactory());
!
/**
* This test does not establish any connection to the specified
* URL, hence a dummy URL is used.
*/
URL foobar = new URL("https://example.com/");