*** ../httpcomponents-client-4.2.3.orig/httpclient/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java 2013-01-11 00:00:23.000000000 +0200 --- httpclient/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java 2013-04-23 16:13:24.000000000 +0300 *************** *** 568,571 **** --- 568,572 ---- prepareSocket(sslsock); } + sslsock.startHandshake(); if (this.hostnameVerifier != null) { try { *************** *** 625,628 **** --- 626,630 ---- true); prepareSocket(sslSocket); + sslSocket.startHandshake(); if (this.hostnameVerifier != null) { this.hostnameVerifier.verify(host, sslSocket); *************** *** 647,650 **** --- 649,653 ---- ); prepareSocket(sslSocket); + sslSocket.startHandshake(); if (this.hostnameVerifier != null) { this.hostnameVerifier.verify(host, sslSocket); *** ../httpcomponents-client-4.2.3.orig/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java 2013-01-11 00:00:21.000000000 +0200 --- httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java 2013-04-23 10:29:53.786326649 +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; *************** *** 161,165 **** } ! @Test(expected=SSLPeerUnverifiedException.class) public void testSSLTrustVerification() throws Exception { // Use default SSL context --- 161,165 ---- } ! @Test(expected=SSLHandshakeException.class) public void testSSLTrustVerification() throws Exception { // Use default SSL context