1 23 24 39 40 package com.sun.enterprise.admin.server.core.jmx.ssl; 41 42 import java.io.Serializable ; 43 import java.io.IOException ; 44 import java.net.Socket ; 45 import java.rmi.server.RMIClientSocketFactory ; 46 import javax.net.ssl.SSLContext; 47 import javax.net.ssl.SSLSocket; 48 import javax.net.ssl.SSLSocketFactory; 49 import com.sun.enterprise.config.serverbeans.Ssl; 50 51 59 public class AdminSslClientSocketFactory implements RMIClientSocketFactory , Serializable { 60 private final Ssl sslc; 61 public AdminSslClientSocketFactory(final Ssl sslc) { 62 if (sslc == null) 63 throw new IllegalArgumentException ("Internal: null ssl configuration"); 64 this.sslc = sslc; 65 } 66 70 71 public Socket createSocket(final String host, final int port) throws IOException { 72 try { 73 final SSLSocketFactory f = (SSLSocketFactory)SSLSocketFactory.getDefault(); 74 final SSLSocket s = (SSLSocket) f.createSocket(host, port); 75 return ( s ); 76 } 77 catch (final Exception e) { 78 throw new IOException (e.getMessage()); 79 } 80 } 81 82 } 83 | Popular Tags |