i get a "Exception in thread "main" javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure" for the code below. Does anybody know how to fix it?
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSession;
public class Test {
static {
System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2,SSLv3,SSLv2Hello");
HostnameVerifier hv = new HostnameVerifier() {
public boolean verify(String urlHostName, SSLSession session) {
return true;
}
};
HttpsURLConnection.setDefaultHostnameVerifier(hv);
}
public static void main(String[] args) throws MalformedURLException, IOException {
HttpURLConnection con = (HttpsURLConnection) new URL("https://www.sureworks.de").openConnection();
con.connect();
}
}
-Djavax.net.debug=ssl
? – Andrew Henle