/** * Obtains the scheme for a host. * Convenience method for <code>getScheme(host.getSchemeName())</pre> * * @param host the host for which to obtain the scheme * * @return the scheme for the given host, never <code>null</code> * * @throws IllegalStateException * if a scheme with the respective name is not registered */ public synchronized final Scheme getScheme(HttpHost host) { if (host == null) { throw new IllegalArgumentException("Host must not be null."); } return getScheme(host.getSchemeName()); }
public KeyStore getKeyStore(){ SchemeRegistry registry = httpClient4.getConnectionManager().getSchemeRegistry(); if(! registry.getSchemeNames().contains("https")){ throw new IllegalStateException("Registry does not include an 'https' entry."); } SchemeSocketFactory awareSocketFactory = httpClient4.getConnectionManager().getSchemeRegistry().getScheme("https").getSchemeSocketFactory(); if(awareSocketFactory instanceof KeyStoreAwareSocketFactory){ return ((KeyStoreAwareSocketFactory) awareSocketFactory).getKeyStore(); }else{ throw new IllegalStateException("Cannot extract keystore from scheme socket factory of type: " + awareSocketFactory.getClass().getName()); } }
if (port < 0) { Scheme scheme = connManager.getSchemeRegistry(). getScheme(target.getSchemeName()); port = scheme.getDefaultPort();
if (port < 0) { Scheme scheme = connManager.getSchemeRegistry(). getScheme(target.getSchemeName()); port = scheme.getDefaultPort();
int port = host.getPort(); if (port < 0) { Scheme scheme = connManager.getSchemeRegistry().getScheme(host); port = scheme.getDefaultPort();
int port = host.getPort(); if (port < 0) { Scheme scheme = connManager.getSchemeRegistry().getScheme(host); port = scheme.getDefaultPort();
final Scheme schm = schemeRegistry.getScheme(target.getSchemeName()); if (!(schm.getSocketFactory() instanceof LayeredSocketFactory)) { throw new IllegalArgumentException
final Scheme schm = schemeRegistry.getScheme(target.getSchemeName()); final SocketFactory sf = schm.getSocketFactory(); final SocketFactory plain_sf;
ConnRouteParams.getDefaultProxy(request.getParams()); final Scheme schm = schemeRegistry.getScheme(target.getSchemeName());
this.schemeRegistry.getScheme(target.getSchemeName());
/** * Constructor. * @param config the client configuration. */ public ApacheHttpClient(ClientConfiguration config) { HttpClientFactory httpClientFactory = new HttpClientFactory(); httpClient = httpClientFactory.createHttpClient(config); // disable retry ((AbstractHttpClient) httpClient) .setHttpRequestRetryHandler(new DefaultHttpRequestRetryHandler(0, false)); SchemeRegistry schemeRegistry = httpClient.getConnectionManager().getSchemeRegistry(); Scheme https = schemeRegistry.getScheme("https"); ((SSLSocketFactory) https.getSocketFactory()) .setHostnameVerifier(SSLSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); }
/** * Obtains the scheme for a host. * Convenience method for {@code getScheme(host.getSchemeName())} * * @param host the host for which to obtain the scheme * * @return the scheme for the given host, never {@code null} * * @throws IllegalStateException * if a scheme with the respective name is not registered */ public final Scheme getScheme(final HttpHost host) { Args.notNull(host, "Host"); return getScheme(host.getSchemeName()); }
/** * Obtains the scheme for a host. * Convenience method for {@code getScheme(host.getSchemeName())} * * @param host the host for which to obtain the scheme * * @return the scheme for the given host, never {@code null} * * @throws IllegalStateException * if a scheme with the respective name is not registered */ public final Scheme getScheme(final HttpHost host) { Args.notNull(host, "Host"); return getScheme(host.getSchemeName()); }
/** * Obtains the scheme for a host. * Convenience method for {@code getScheme(host.getSchemeName())} * * @param host the host for which to obtain the scheme * * @return the scheme for the given host, never {@code null} * * @throws IllegalStateException * if a scheme with the respective name is not registered */ public final Scheme getScheme(final HttpHost host) { Args.notNull(host, "Host"); return getScheme(host.getSchemeName()); }
/** * Obtains the scheme for a host. * Convenience method for {@code getScheme(host.getSchemeName())} * * @param host the host for which to obtain the scheme * * @return the scheme for the given host, never {@code null} * * @throws IllegalStateException * if a scheme with the respective name is not registered */ public final Scheme getScheme(final HttpHost host) { Args.notNull(host, "Host"); return getScheme(host.getSchemeName()); }
/** * Obtains the scheme for a host. * Convenience method for <code>getScheme(host.getSchemeName())</pre> * * @param host the host for which to obtain the scheme * * @return the scheme for the given host, never <code>null</code> * * @throws IllegalStateException * if a scheme with the respective name is not registered */ public final Scheme getScheme(final HttpHost host) { Args.notNull(host, "Host"); return getScheme(host.getSchemeName()); }
public int getRemotePort() { HttpHost host = route.getTargetHost(); return connManager.getSchemeRegistry().getScheme(host).resolvePort(host.getPort()); }
public int getRemotePort() { HttpHost host = route.getTargetHost(); return connManager.getSchemeRegistry().getScheme(host).resolvePort(host.getPort()); }
public int getRemotePort() { HttpHost host = route.getTargetHost(); return connManager.getSchemeRegistry().getScheme(host).resolvePort(host.getPort()); }
/** * Constructor. * @param config the client configuration. */ public ApacheHttpClient(ClientConfiguration config) { HttpClientFactory httpClientFactory = new HttpClientFactory(); httpClient = httpClientFactory.createHttpClient(config); // disable retry ((AbstractHttpClient) httpClient) .setHttpRequestRetryHandler(new DefaultHttpRequestRetryHandler(0, false)); SchemeRegistry schemeRegistry = httpClient.getConnectionManager().getSchemeRegistry(); Scheme https = schemeRegistry.getScheme("https"); ((SSLSocketFactory) https.getSocketFactory()) .setHostnameVerifier(SSLSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); }