How to re-set the SSLSocketFactory
843811Jan 19 2009 — edited Jan 26 2009Hi All,
Basically I am using the SSLSocketFactory to create the default SSL socket factory.
As below
private static SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.
getDefault();
Before creating the socket there are a few system properties which is being loaded as mentioned below
System.setProperty("javax.net.ssl.trustStore", "");
System.setProperty("javax.net.ssl.trustStorePassword", "");
System.setProperty("javax.net.ssl.keyStore","");
System.setProperty("javax.net.ssl.keyStorePassword", ""); etc...
Later point in time , i.e based on a condition i would like to change the System properties with different values and re-create the socket.
somehow I could not successfully re-create the socket. I am getting that feel that factory is still points to the old values.
In fact I've re-created the default factory by calling the SSLSocketFactory.getDefault() after changing the System property Values.
Somehow no effect. I am suspecting that, the socket is not re-created again.By any chance it is a singleton ? or how can I re-set the socket to look at my latest System variables.
Your help is highly appreciated.