KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > remoting > transport > socket > ssl > SSLSocketClientInvoker


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.remoting.transport.socket.ssl;
8
9 import java.io.IOException JavaDoc;
10 import java.net.Socket JavaDoc;
11 import javax.net.SocketFactory;
12 import org.jboss.remoting.InvokerLocator;
13 import org.jboss.remoting.security.SSLSocketBuilder;
14 import org.jboss.remoting.transport.socket.SocketClientInvoker;
15
16 /**
17  * @author <a HREF="mailto:tom.elrod@jboss.com">Tom Elrod</a>
18  */

19 public class SSLSocketClientInvoker extends SocketClientInvoker
20 {
21    public SSLSocketClientInvoker(InvokerLocator locator) throws IOException JavaDoc
22    {
23       super(locator);
24    }
25
26    protected Socket JavaDoc createSocket(String JavaDoc address, int port) throws IOException JavaDoc
27    {
28       SSLSocketBuilder server = new SSLSocketBuilder();
29       SocketFactory sf = null;
30       try
31       {
32          sf = server.createSSLSocketFactory();
33       }
34       catch(Exception JavaDoc e)
35       {
36          log.error("Error creating SSL Socket Factory for client invoker.", e);
37          throw new IOException JavaDoc("Error creating SSL Socket Factory. Root cause: " + e.getMessage());
38       }
39       Socket JavaDoc s = sf.createSocket(address, port);
40
41       return s;
42    }
43
44 }
Popular Tags