public CloseableHttpClient createClient() throws JHttpCException { return createClient( null, null ); }
public CloseableHttpClient newClient() throws IndyClientException { try { return factory.createClient( location, defaultHeaders ); } catch ( JHttpCException e ) { throw new IndyClientException( "Indy request failed: %s", e, e.getMessage() ); } }
/** * Create http client and apply site config. * @param siteId ID to represent the site. It is generally the hostname of target site. * @return * @throws IndyHttpException */ public CloseableHttpClient createClient( final String siteId ) throws IndyHttpException { try { return httpFactory.createClient( siteConfigLookup.lookup( siteId ) ); } catch ( JHttpCException e ) { throw new IndyHttpException( "Failed to create http client: %s", e, e.getMessage() ); } }
try client = httpFactory.createClient( config.getKojiSiteConfig() );
public CloseableHttpClient createClient( final SiteConfig location, final List<Header> defaultHeaders ) throws JHttpCException { CloseableHttpClient client; if ( location != null ) { HttpClientBuilder builder = HttpClients.custom(); if ( authenticator != null ) { builder = authenticator.decorateClientBuilder( builder ); } logger.debug( "Using site config: {} for advanced client options", location ); SiteConnectionConfig connConfig = new SiteConnectionConfig( location ); final SSLConnectionSocketFactory sslFac = createSSLSocketFactory( location ); if ( sslFac != null ) { // HostnameVerifier verifier = new SSLHostnameVerifierImpl( ); // builder.setSSLHostnameVerifier( verifier ); builder.setSSLSocketFactory( sslFac ); connConfig.withSSLConnectionSocketFactory( sslFac ); } ConnectionManagerTracker managerWrapper = connectionCache.getTrackerFor( connConfig ); logger.debug( "Using connection manager tracker: {}", managerWrapper ); builder.setConnectionManager( managerWrapper.acquire() ); if ( location.getProxyHost() != null )
try client = httpFactory.createClient( siteConfig );
return httpFactory.createClient( config ); return httpFactory.createClient();