Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to re-set the SSLSocketFactory

843811Jan 19 2009 — edited Jan 26 2009
Hi 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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 23 2009
Added on Jan 19 2009
2 comments
358 views