*** ../httpcomponents-client-4.3-alpha1.orig/httpclient/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java 2013-04-23 16:18:32.174859014 +0300 --- httpclient/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java 2013-04-23 16:22:00.000000000 +0300 *************** *** 697,700 **** --- 697,701 ---- // Setup SSL layering if necessary if (sock instanceof SSLSocket) { + ((SSLSocket) sock).startHandshake(); verifyHostname((SSLSocket) sock, host.getHostName()); } else { *************** *** 715,718 **** --- 716,720 ---- true); prepareSocket(sslSocket); + sslSocket.startHandshake(); verifyHostname(sslSocket, target); return sslSocket; *** ../httpcomponents-client-4.3-alpha1.orig/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java 2013-04-23 16:18:32.154859013 +0300 --- httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java 2013-04-23 16:18:40.310858741 +0300 *************** *** 40,44 **** import javax.net.ssl.SSLContext; import javax.net.ssl.SSLException; ! import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; --- 40,44 ---- import javax.net.ssl.SSLContext; import javax.net.ssl.SSLException; ! import javax.net.ssl.SSLHandshakeException; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; *************** *** 157,161 **** } ! @Test(expected=SSLPeerUnverifiedException.class) public void testSSLTrustVerification() throws Exception { final HttpHost host = new HttpHost("localhost", 443, "https"); --- 157,161 ---- } ! @Test(expected=SSLHandshakeException.class) public void testSSLTrustVerification() throws Exception { final HttpHost host = new HttpHost("localhost", 443, "https");