package mit.rmi ;

public class ClientSocketFactory
implements	java.rmi.server.RMIClientSocketFactory
	,	java.io.Serializable
{
	private static final int SOCKET_TIMEOUT = 10000 ; 
	private static javax.net.SocketFactory sslFactory = null ;
	private static java.rmi.server.RMISocketFactory rmiFactory = null ;

        // 1. Make synchronized?
        // 2. Add // throws IOException to signature
	public java.net.Socket createSocket(String host, int port) 
        throws java.io.IOException
	{
                System.err.println("In createSocket(" + host + "," + port + " at " + new java.util.Date() );
		if( null == sslFactory )
		{
			sslFactory = javax.net.ssl.SSLSocketFactory.getDefault() ;
		}
		javax.net.ssl.SSLSocket s
		= ( javax.net.ssl.SSLSocket ) sslFactory.createSocket( host , port ) ;
		s.setEnabledCipherSuites( s.getSupportedCipherSuites() ) ;
		s.setSoTimeout( SOCKET_TIMEOUT ) ;
                System.err.println("Out of createSocket(" + host + "," + port + " at " + new java.util.Date() );
		return s ;
	}

	public boolean equals( Object that ) 
	{ 
		return that != null && that.getClass() == this.getClass() ; 
	}

}
