List of usage examples for org.apache.http.impl.conn PoolingHttpClientConnectionManager getDefaultMaxPerRoute
public int getDefaultMaxPerRoute()
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 w ww . j av a2 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: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 w w .j a v a2 s. 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();// w w w . ja va 2 s . com PoolingHttpClientConnectionManager connMgr = (PoolingHttpClientConnectionManager) getFilter() .getConnectionManager(); assertEquals(200, connMgr.getMaxTotal()); assertEquals(20, connMgr.getDefaultMaxPerRoute()); }