Cannot connect using URLConnection and JSSE

Hi,

I am using the following code:

System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");

Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

I also pass -Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol

as argument to the java VM. However, the code below throws IOException with the message: "HTTPS hostname wrong: should be <mail.yahoo.com>"

URLConnection con;

URL url = new URL("https://mail.yahoo.com");

con = url.openConnection();

con.connect();

What can I do?

[606 byte] By [cristi_botizaa] at [2007-10-1 2:56:45]
# 1
Write your own HostnameVerifier, it sounds like mail.yahoo.com isn't sendinga properly formed certificate.P.S. If you're using JSSE in 1.4 or above, the SunJSSE is already installed, andthe setProperty/addProvider shouldn't be done.
wetmorea at 2007-7-8 15:35:04 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...