HttpParams params = createDefaultParams();
ConnManagerParams.setMaxTotalConnections(params, 1);
ThreadSafeClientConnManager mgr = createTSCCM(params, null);
HttpHost target1 = new HttpHost("www.test1.invalid", 80, "http");
HttpRoute route1 = new HttpRoute(target1, null, false);
HttpHost target2 = new HttpHost("www.test2.invalid", 80, "http");
HttpRoute route2 = new HttpRoute(target2, null, false);
// get the only connection, then start two extra threads
ManagedClientConnection conn =
getConnection(mgr, route1, 1L, TimeUnit.MILLISECONDS);