/** * Default constructor. * * @since 4.3 */ public BasicAuthCache(final SchemePortResolver schemePortResolver) { super(); this.map = new HashMap<HttpHost, AuthScheme>(); this.schemePortResolver = schemePortResolver != null ? schemePortResolver : DefaultSchemePortResolver.INSTANCE; }
HttpClientConnectionOperator( final Lookup<ConnectionSocketFactory> socketFactoryRegistry, final SchemePortResolver schemePortResolver, final DnsResolver dnsResolver) { super(); Args.notNull(socketFactoryRegistry, "Socket factory registry"); this.socketFactoryRegistry = socketFactoryRegistry; this.schemePortResolver = schemePortResolver != null ? schemePortResolver : DefaultSchemePortResolver.INSTANCE; this.dnsResolver = dnsResolver != null ? dnsResolver : SystemDefaultDnsResolver.INSTANCE; }
public BasicHttpClientConnectionManager( final Lookup<ConnectionSocketFactory> socketFactoryRegistry, final HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> connFactory, final SchemePortResolver schemePortResolver, final DnsResolver dnsResolver) { super(); this.connectionOperator = new HttpClientConnectionOperator( socketFactoryRegistry, schemePortResolver, dnsResolver); this.connFactory = connFactory != null ? connFactory : ManagedHttpClientConnectionFactory.INSTANCE; this.expiry = Long.MAX_VALUE; this.socketConfig = SocketConfig.DEFAULT; this.connConfig = ConnectionConfig.DEFAULT; this.isShutdown = new AtomicBoolean(false); }
public PoolingHttpClientConnectionManager( final Registry<ConnectionSocketFactory> socketFactoryRegistry, final HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> connFactory, final SchemePortResolver schemePortResolver, final DnsResolver dnsResolver, final long timeToLive, final TimeUnit tunit) { super(); this.configData = new ConfigData(); this.pool = new CPool( new InternalConnectionFactory(this.configData, connFactory), 2, 20, timeToLive, tunit); this.connectionOperator = new HttpClientConnectionOperator( socketFactoryRegistry, schemePortResolver, dnsResolver); this.isShutDown = new AtomicBoolean(false); }
PoolingHttpClientConnectionManager( final CPool pool, final Lookup<ConnectionSocketFactory> socketFactoryRegistry, final SchemePortResolver schemePortResolver, final DnsResolver dnsResolver) { super(); this.configData = new ConfigData(); this.pool = pool; this.connectionOperator = new HttpClientConnectionOperator( socketFactoryRegistry, schemePortResolver, dnsResolver); this.isShutDown = new AtomicBoolean(false); }
/** * Default constructor. * * @since 4.3 */ public BasicAuthCache(final SchemePortResolver schemePortResolver) { super(); this.map = new ConcurrentHashMap<HttpHost, byte[]>(); this.schemePortResolver = schemePortResolver != null ? schemePortResolver : DefaultSchemePortResolver.INSTANCE; }
public BasicHttpClientConnectionManager( final Lookup<ConnectionSocketFactory> socketFactoryRegistry, final HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> connFactory, final SchemePortResolver schemePortResolver, final DnsResolver dnsResolver) { this( new DefaultHttpClientConnectionOperator(socketFactoryRegistry, schemePortResolver, dnsResolver), connFactory ); }
public PoolingHttpClientConnectionManager( final Registry<ConnectionSocketFactory> socketFactoryRegistry, final HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> connFactory, final SchemePortResolver schemePortResolver, final DnsResolver dnsResolver, final long timeToLive, final TimeUnit tunit) { this( new DefaultHttpClientConnectionOperator(socketFactoryRegistry, schemePortResolver, dnsResolver), connFactory, timeToLive, tunit ); }
/** * Visible for test. */ PoolingHttpClientConnectionManager( final CPool pool, final Lookup<ConnectionSocketFactory> socketFactoryRegistry, final SchemePortResolver schemePortResolver, final DnsResolver dnsResolver) { super(); this.configData = new ConfigData(); this.pool = pool; this.connectionOperator = new DefaultHttpClientConnectionOperator( socketFactoryRegistry, schemePortResolver, dnsResolver); this.isShutDown = new AtomicBoolean(false); }
public DefaultHttpClientConnectionOperator( final Lookup<ConnectionSocketFactory> socketFactoryRegistry, final SchemePortResolver schemePortResolver, final DnsResolver dnsResolver) { super(); Args.notNull(socketFactoryRegistry, "Socket factory registry"); this.socketFactoryRegistry = socketFactoryRegistry; this.schemePortResolver = schemePortResolver != null ? schemePortResolver : DefaultSchemePortResolver.INSTANCE; this.dnsResolver = dnsResolver != null ? dnsResolver : SystemDefaultDnsResolver.INSTANCE; }
@Test public void testGetKeyWithSchemeRegistry() throws Exception { final SchemePortResolver schemePortResolver = Mockito.mock(SchemePortResolver.class); final BasicAuthCache cache = new BasicAuthCache(schemePortResolver); Mockito.when(schemePortResolver.resolve(new HttpHost("localhost", -1, "https"))).thenReturn(443); final HttpHost target = new HttpHost("localhost", 443, "https"); Assert.assertSame(target, cache.getKey(target)); Assert.assertEquals(target, cache.getKey(new HttpHost("localhost", -1, "https"))); }
@Before public void setup() { defaultProxy = new HttpHost("default.proxy.host", 8888); schemePortResolver = Mockito.mock(SchemePortResolver.class); routePlanner = new DefaultProxyRoutePlanner(defaultProxy, schemePortResolver); }
@SuppressWarnings("unchecked") @Before public void setup() throws Exception { conn = Mockito.mock(ManagedHttpClientConnection.class); socket = Mockito.mock(Socket.class); plainSocketFactory = Mockito.mock(ConnectionSocketFactory.class); sslSocketFactory = Mockito.mock(LayeredConnectionSocketFactory.class); socketFactoryRegistry = Mockito.mock(Lookup.class); schemePortResolver = Mockito.mock(SchemePortResolver.class); dnsResolver = Mockito.mock(DnsResolver.class); connectionOperator = new DefaultHttpClientConnectionOperator( socketFactoryRegistry, schemePortResolver, dnsResolver); }
/** * Initilisation procedure for this test case. * * @throws UnableToBuildSolRDFClientException in case the client cannot be built. * @throws Exception in case of Solr startup failure. */ @BeforeClass public static void initITTest() { System.setProperty("tests.asserts", "false"); System.setProperty("jetty.port", "8080"); System.setProperty("solr.core.name", "store"); System.setProperty("solr.data.dir", initCoreDataDir.getAbsolutePath()); try { SOLR = createJetty( "target/solrdf-integration-tests-1.1-dev/solrdf", JettyConfig.builder() .setPort(8080) .setContext("/solr") .stopAtShutdown(true) .build()); final HttpClient httpClient = HttpClientBuilder.create() .setRoutePlanner( new DefaultRoutePlanner( new SchemePortResolver() { @Override public int resolve(final HttpHost host) throws UnsupportedSchemeException { return SOLR.getLocalPort(); } })).build(); SOLRDF_CLIENT = SolRDF.newBuilder() .withEndpoint("http://127.0.0.1:8080/solr/store") .withGraphStoreProtocolEndpointPath("/rdf-graph-store") .withHttpClient(httpClient) .withSPARQLEndpointPath("/sparql") .build(); PLAIN_SOLR_CLIENT = new HttpSolrClient(SOLR_URI); } catch (final Exception exception) { throw new RuntimeException(exception); } }
/** * Assigns {@link SchemePortResolver} instance. */ public final HttpClientBuilder setSchemePortResolver( final SchemePortResolver schemePortResolver) { this.schemePortResolver = schemePortResolver; return this; }
public SystemDefaultRoutePlanner( final SchemePortResolver schemePortResolver, final ProxySelector proxySelector) { super(schemePortResolver); this.proxySelector = proxySelector != null ? proxySelector : ProxySelector.getDefault(); }
public DefaultRoutePlanner(final SchemePortResolver schemePortResolver) { super(); this.schemePortResolver = schemePortResolver != null ? schemePortResolver : DefaultSchemePortResolver.INSTANCE; }
public DefaultProxyRoutePlanner(final HttpHost proxy, final SchemePortResolver schemePortResolver) { super(schemePortResolver); this.proxy = Args.notNull(proxy, "Proxy host"); }
@Before public void setup() { schemePortResolver = Mockito.mock(SchemePortResolver.class); proxySelector = Mockito.mock(ProxySelector.class); routePlanner = new SystemDefaultRoutePlanner(schemePortResolver, proxySelector); }
@Before public void setup() { schemePortResolver = Mockito.mock(SchemePortResolver.class); routePlanner = new DefaultRoutePlanner(schemePortResolver); }