'How to set up multiple HTTPS connections in Java
I'm using HTTPS to connect to web services. The problem is that I need to connect to 2 web services and then they have different certificates. In this class there is this code:
public static synchronized SocketFactory getFactory(String protocol,
Hashtable attributes) {
SocketFactory theFactory = (SocketFactory) factories.get(protocol);
if (theFactory == null) {
Object[] objects = { attributes };
if (protocol.equalsIgnoreCase("http")) {
theFactory = (SocketFactory) AxisProperties.newInstance(
SocketFactory.class, classes, objects);
} else if (protocol.equalsIgnoreCase("https")) {
theFactory = (SecureSocketFactory) AxisProperties.newInstance(
SecureSocketFactory.class, classes, objects);
}
if (theFactory != null)
factories.put(protocol, theFactory);
}
}
return theFactory;
}
If you set up the configuration for HTTPS, and now, you want to set up another configurarion for HTTPS, you cannot do it because the code returns the first configuration.
How can I solve it?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
