基于HTTPS/SSL的Java客户端证书
HttpsURLConnection
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/security/cacerts
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed' problem.
SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();URL url = new URL(" HttpsURLConnection conn = (HttpsURLConnection)url.openConnection();conn.setSSLSocketFactory(sslsocketfactory); InputStream inputstream = conn.getInputStream();// The last line fails, and gives: // javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault(); SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket("somehost.dk", 3049); InputStream inputstream = sslsocket.getInputStream(); // do anything with the inputstream results in: // java.net.SocketTimeoutException: Read timed out