On Sun, 2016-04-10 at 15:29 +0530, Venkata Pavan Kumar Sannisetty wrote:
> Is there any way to setup a separate SSL Context Factory for each route in
> Apache HTTP Client. From the documentation i can only see we can configure
> SSLContextFactory per scheme not per route.
> 
> Registry<ConnectionSocketFactory> r =
> RegistryBuilder.<ConnectionSocketFactory>create()
>             .register("http", plainsf)
>             .register("https", sslsf)
>             .build();
> 
>     HttpClientConnectionManager cm = new 
> PoolingHttpClientConnectionManager(r);
>     HttpClients.custom()
>             .setConnectionManager(cm)
>             .build();
> 
> All my target endpoints are protected with HTTPS and mandates client
> certificate authentication. For each of these endpoint i have to select a
> specific client certificate & present it to the endpoint server. Currently
> i am seeing the only is to create a separate HTTPClient instance for each
> target endpoint route.
> 
> I am here looking for any pointers to improving this design.
> 
> Thanks.

One can use 'http.socket-factory-registry' context attribute to that end
but please note this feature is considered undocumented. 

http://hc.apache.org/httpcomponents-client-4.5.x/httpclient/xref/org/apache/http/impl/conn/DefaultHttpClientConnectionOperator.html#66

Please also note that one can build a custom ConnectionSocketFactory
that makes use of custom context attributes when creating SSL sockets.
That would be the recommended way to solve the issue.

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org

Reply via email to