1 24 25 package org.objectweb.cjdbc.common.net; 26 27 import java.io.IOException ; 28 import java.io.Serializable ; 29 import java.net.Socket ; 30 import java.rmi.server.RMIClientSocketFactory ; 31 32 import javax.net.ssl.SSLSocket; 33 import javax.net.ssl.SSLSocketFactory; 34 35 41 public class RMISSLClientSocketFactory 42 implements 43 RMIClientSocketFactory , 44 Serializable 45 { 46 private static final long serialVersionUID = -5994304413561755872L; 47 48 52 public Socket createSocket(String host, int port) throws IOException 53 { 54 SSLSocket socket = (SSLSocket) SSLSocketFactory.getDefault().createSocket( 55 host, port); 56 if (System.getProperty("javax.net.ssl.trustStore") != null) 57 socket.setNeedClientAuth(true); 58 59 return socket; 60 } 61 62 67 public boolean equals(Object obj) 68 { 69 if (obj == null) 70 return false; 71 if (this == obj) 72 return true; 73 return getClass() == obj.getClass(); 74 } 75 76 81 public int hashCode() 82 { 83 return 13; 84 } 85 } 86 | Popular Tags |