@Test(groups = { "standalone", "default_provider" })
public void remoteNegHostnameVerifierTest() throws Exception {
// request is made to 127.0.0.1, but cert presented for localhost - this should fail
final AsyncHttpClient client = getAsyncHttpClient(new Builder().setHostnameVerifier(new CheckHost("localhost")).setSSLContext(createSSLContext(new AtomicBoolean(true))).build());
try {
client.preparePost(getTargetUrl()).setBody(SIMPLE_TEXT_FILE).setHeader("Content-Type", "text/html").execute().get();
fail("ConnectException expected");
} catch (ExecutionException ex) {
assertEquals(ex.getCause().getClass(), ConnectException.class);
} finally {
client.close();