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