List of usage examples for org.apache.http.impl.conn PoolingHttpClientConnectionManager getMaxTotal
public int getMaxTotal()
From source file:com.streamsets.datacollector.credential.cyberark.TestWebServicesFetcher.java
@Test public void testInitializationDefaults() throws Exception { Properties props = new Properties(); props.setProperty(WebServicesFetcher.URL_KEY, "http://foo"); props.setProperty(WebServicesFetcher.APP_ID_KEY, "appId"); Configuration conf = createConfig(props); WebServicesFetcher fetcher = new WebServicesFetcher(); try {/*from ww w . ja va 2 s . com*/ fetcher.init(conf); Assert.assertNotNull(fetcher.getConfig()); Assert.assertEquals("http://foo", fetcher.getUrl()); Assert.assertEquals("appId", fetcher.getAppId()); Assert.assertEquals(WebServicesFetcher.CONNECTION_TIMEOUT_DEFAULT, fetcher.getConnectionTimeout()); Assert.assertEquals(WebServicesFetcher.NAME_SEPARATOR_DEFAULT, fetcher.getSeparator()); Assert.assertEquals(WebServicesFetcher.HTTP_AUTH_NONE, fetcher.getHttpAuth()); Assert.assertNull(fetcher.getCredentialsProvider()); Assert.assertNull(fetcher.getAuthCache()); PoolingHttpClientConnectionManager connectionManager = fetcher.getConnectionManager(); Assert.assertEquals(WebServicesFetcher.MAX_CONCURRENT_CONNECTIONS_DEFAULT, connectionManager.getMaxTotal()); Assert.assertEquals(WebServicesFetcher.MAX_CONCURRENT_CONNECTIONS_DEFAULT, connectionManager.getDefaultMaxPerRoute()); Assert.assertEquals(WebServicesFetcher.VALIDATE_AFTER_INACTIVITY_DEFAULT, connectionManager.getValidateAfterInactivity()); Assert.assertNull(fetcher.getSslConnectionSocketFactory()); } finally { fetcher.destroy(); } }
From source file:com.spotify.docker.client.DefaultDockerClient.java
private PoolingHttpClientConnectionManager getConnectionManager(Builder builder) { final PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager( getSchemeRegistry(builder)); // Use all available connections instead of artificially limiting ourselves to 2 per server. cm.setMaxTotal(builder.connectionPoolSize); cm.setDefaultMaxPerRoute(cm.getMaxTotal()); return cm;/* w w w.j a v a 2s .c o m*/ }
From source file:org.springframework.cloud.netflix.zuul.filters.route.SimpleHostRoutingFilterTests.java
@Test public void connectionPropertiesAreApplied() { addEnvironment(this.context, "zuul.host.maxTotalConnections=100", "zuul.host.maxPerRouteConnections=10", "zuul.host.timeToLive=5", "zuul.host.timeUnit=SECONDS"); setupContext();//from w ww . j a v a 2s.c o m PoolingHttpClientConnectionManager connMgr = (PoolingHttpClientConnectionManager) getFilter() .getConnectionManager(); assertEquals(100, connMgr.getMaxTotal()); assertEquals(10, connMgr.getDefaultMaxPerRoute()); Object pool = getField(connMgr, "pool"); Long timeToLive = getField(pool, "timeToLive"); TimeUnit timeUnit = getField(pool, "tunit"); assertEquals(new Long(5), timeToLive); assertEquals(TimeUnit.SECONDS, timeUnit); }
From source file:org.springframework.cloud.netflix.zuul.filters.route.SimpleHostRoutingFilterTests.java
@Test public void defaultPropertiesAreApplied() { setupContext();//from ww w.j a va2s.c o m PoolingHttpClientConnectionManager connMgr = (PoolingHttpClientConnectionManager) getFilter() .getConnectionManager(); assertEquals(200, connMgr.getMaxTotal()); assertEquals(20, connMgr.getDefaultMaxPerRoute()); }