final HttpGet httpget = new HttpGet("/dropdead");
final HttpHost target = getServerHttp();
final HttpResponse response = this.httpclient.execute(target, httpget);
ConnectionRequest connreq = this.mgr.requestConnection(new HttpRoute(target), null);
try {
connreq.get(250, TimeUnit.MILLISECONDS);
Assert.fail("ConnectionPoolTimeoutException should have been thrown");
} catch (final ConnectionPoolTimeoutException expected) {
}
final HttpEntity e = response.getEntity();
Assert.assertNotNull(e);
// Read the content
try {
EntityUtils.toByteArray(e);
Assert.fail("MalformedChunkCodingException should have been thrown");
} catch (final MalformedChunkCodingException expected) {
}
// Expect zero connections in the pool
Assert.assertEquals(0, this.mgr.getTotalStats().getAvailable());
// Make sure one connection is available
connreq = this.mgr.requestConnection(new HttpRoute(target), null);
final HttpClientConnection conn = connreq.get(250, TimeUnit.MILLISECONDS);
this.mgr.releaseConnection(conn, null, -1, null);
}