[jboss-user] [JBoss Messaging] - Re: Secure Socket Connection Example question

kadlecp do-not-reply at jboss.com
Thu Sep 27 07:10:22 EDT 2007

I have been trying to solve the problem and my solution is:

public class SecureSocketExample extends ExampleSupport {
public static void main(String[] args) {
    System.setProperty(SSLSocketBuilder.REMOTING_DEFAULT_SOCKET_FACTORY_CLASS,   "org.jboss.example.jms.common.MySSLSocketFactory");
    new SecureSocketExample().run();

public class MySSLSocketFactory {
	static {
		   HashMap<String, String> config = new HashMap<String, String>();
		   config.put(SSLSocketBuilder.REMOTING_KEY_STORE_FILE_PATH, "client.keystore");
		   config.put(SSLSocketBuilder.REMOTING_KEY_STORE_PASSWORD, "pssword");
		   config.put(SSLSocketBuilder.REMOTING_TRUST_STORE_FILE_PATH, "client.truststore");
		   config.put(SSLSocketBuilder.REMOTING_TRUST_STORE_PASSWORD, "password");
		   SSLSocketBuilder ssb = new SSLSocketBuilder(config);
		   try {
			sf = ssb.createSSLSocketFactory(null);
		} catch (Exception e) {
	private static SocketFactory sf;
	public static SocketFactory getDefault() {
		return sf;

Now the runtime reads truststore, keystore info from the configuration map. I will try to fill the map from the resource file of the deploy war/jar/ear... So I can have more different queue clients talking to different "ssl" queues. 

If you have better solution, please suggest it.
Pavel Kadlec

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4089265#4089265

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4089265

More information about the jboss-user mailing list