public void testMaxConnPerHost() throws Exception {
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);
HttpHost target3 = new HttpHost("www.test3.invalid", 80, "http");
HttpRoute route3 = new HttpRoute(target3, null, false);
HttpParams params = createDefaultParams();
HttpConnectionManagerParams.setMaxTotalConnections(params, 100);
HttpConnectionManagerParams.setDefaultMaxConnectionsPerHost(params, 1);
//@@@ HostConfiguration is deprecated
//@@@ should it be mapped to HttpHost or HttpRoute here?
//@@@ provide setter in TSCCM, it is implementation specific
HttpConnectionManagerParams.setMaxConnectionsPerHost
(params, route2.toHostConfig(), 2);
HttpConnectionManagerParams.setMaxConnectionsPerHost
(params, route3.toHostConfig(), 3);
ThreadSafeClientConnManager mgr = createTSCCM(params, null);
// route 3, limit 3
ManagedClientConnection conn1 = mgr.getConnection(route3, 10L);