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