hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCLIENT-1689) HttpClientBuilder ignores SSLContext if HttpClientConnectionManager is not null
Date Sun, 11 Oct 2015 09:00:13 GMT

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1689?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14952222#comment-14952222
] 

Oleg Kalnichevski commented on HTTPCLIENT-1689:
-----------------------------------------------

Doing what exactly? 

There is no way to modify the connection manager once it has been created. {{HttpClientConnectionManager}}
is immutable. 

If all you want is to provide a custom {{SSLConnectionSocketFactory}} implementation, then
this is precisely what you should be doing

{code}
CloseableHttpClient client = HttpClientBuilder.create()
        .setSSLSocketFactory(new SSLConnectionSocketFactory(SSLContexts.createSystemDefault()))
        .build();
{code}

If you want to build your own {{HttpClientConnectionManager}} instance, then you need to initialize
it correctly

{code}
Registry<ConnectionSocketFactory> connectionSocketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
        .register("http", PlainConnectionSocketFactory.getSocketFactory())
        .register("https", new SSLConnectionSocketFactory(SSLContexts.createSystemDefault()))
        .build();
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(connectionSocketFactoryRegistry);
CloseableHttpClient client = HttpClientBuilder.create()
        .setConnectionManager(cm)
        .build();
{code}

Oleg

> HttpClientBuilder ignores SSLContext if HttpClientConnectionManager is not null
> -------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1689
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1689
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpCache
>    Affects Versions: 4.5
>         Environment: N/A
>            Reporter: Chaithanya Kanumolu
>            Priority: Minor
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message