[ 
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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to