1 /*
2  * @(#) $Id: RMISSLClientSocketFactory.java,v 1.3 2003/07/08 08:13:53 pankaj Exp $
3  *
4  * Copyright (c) 2002-03 by Pankaj Kumar (http://www.pankaj-k.net). 
5  * All rights reserved.
6  *
7  * The license governing the use of this file can be found in the 
8  * root directory of the containing software.
9  */
10package org.jstk.ssl;
11
12import java.io.IOException;
13import java.io.Serializable;
14import java.net.Socket;
15import java.rmi.server.RMIClientSocketFactory;
16import javax.net.ssl.SSLSocketFactory;
17import javax.net.SocketFactory;
18import javax.net.ssl.SSLSocket;
19
20public class RMISSLClientSocketFactory implements RMIClientSocketFactory, Serializable {
21    public Socket createSocket(String host, int port) throws IOException {
22        SocketFactory factory = SSLSocketFactory.getDefault();
23        int outPort = ClientCommand.getOutPort();
24        if (outPort != -1)
25            port = outPort;
26        Socket socket = factory.createSocket(host, port);
27        return socket;
28    }
29}
30