SSLSocketFactory socketFactory = new SSLSocketFactory(sslcontext);
socketFactory.setHostnameVerifier(hostnameVerifier);
Scheme https = new Scheme("https", socketFactory, 443);
DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.getConnectionManager().getSchemeRegistry().register(https);
HttpHost target = new HttpHost(
LocalTestServer.TEST_SERVER_ADDR.getHostName(),
server.getServicePort(),
"https");
HttpGet httpget = new HttpGet("/random/100");
HttpResponse response = httpclient.execute(target, httpget);
assertEquals(200, response.getStatusLine().getStatusCode());
assertTrue(hostnameVerifier.isFired());
} finally {
server.stop();
}