Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.1
-
None
Description
ProviderProcessor creates a new CommonsHttpSSLSocketFactory/Protocol instance for each message. These instances are in turn used as a part of HttpHost equals/hashCode identity. HttpHost instances are internally cached by MultiThreadedHttpConnectionManager and having new CommonsHttpSSLSocketFactory creates a new cache instance for every call.
Making Protocol an instance variable and changing:
if (uri.getScheme().equals("https")) { ProtocolSocketFactory sf = new CommonsHttpSSLSocketFactory( endpoint.getSsl(), endpoint.getKeystoreManager()); Protocol protocol = new Protocol("https", sf, 443); HttpHost httphost = new HttpHost(uri.getHost(), uri.getPort(), protocol); host = new HostConfiguration(); host.setHost(httphost); } else {
to:
if (uri.getScheme().equals("https")) { synchronized (this) { if (protocol == null) { ProtocolSocketFactory sf = new CommonsHttpSSLSocketFactory( endpoint.getSsl(), endpoint.getKeystoreManager()); protocol = new Protocol("https", sf, 443); } } HttpHost httphost = new HttpHost(uri.getHost(), uri.getPort(), protocol); host = new HostConfiguration(); host.setHost(httphost); } else {
seems to work.