1 45 package org.exolab.jms.net.tcp; 46 47 import java.io.IOException ; 48 import java.net.InetAddress ; 49 import java.net.ServerSocket ; 50 import java.net.Socket ; 51 import javax.net.ServerSocketFactory; 52 import javax.net.ssl.SSLServerSocket; 53 import javax.net.ssl.SSLServerSocketFactory; 54 55 import EDU.oswego.cs.dl.util.concurrent.PooledExecutor; 56 57 import org.exolab.jms.net.connector.Authenticator; 58 import org.exolab.jms.net.connector.ManagedConnection; 59 import org.exolab.jms.net.connector.ResourceException; 60 import org.exolab.jms.net.connector.URIRequestInfo; 61 import org.exolab.jms.net.socket.SocketManagedConnectionAcceptor; 62 import org.exolab.jms.net.socket.SocketRequestInfo; 63 import org.exolab.jms.net.uri.URI; 64 import org.exolab.jms.net.util.SSLProperties; 65 import org.exolab.jms.net.util.SSLHelper; 66 67 68 75 class TCPSManagedConnectionAcceptor 76 extends SocketManagedConnectionAcceptor { 77 78 96 public TCPSManagedConnectionAcceptor(Authenticator authenticator, 97 TCPSRequestInfo info) 98 throws ResourceException { 99 super(authenticator, info); 100 } 101 102 103 114 protected ServerSocket createServerSocket(int port, int backlog, 115 InetAddress host) 116 throws IOException { 117 TCPSRequestInfo info = (TCPSRequestInfo) getRequestInfo(); 118 SSLProperties properties = info.getSSLProperties(); 119 if (properties != null) { 120 SSLHelper.configure(properties); 121 } 122 ServerSocketFactory factory = 123 SSLServerSocketFactory.getDefault(); 124 SSLServerSocket socket = (SSLServerSocket) factory.createServerSocket( 125 port, backlog, host); 126 socket.setNeedClientAuth(info.getNeedClientAuth()); 127 return socket; 128 } 129 130 141 protected ManagedConnection createManagedConnection( 142 URI uri, Socket socket, Authenticator authenticator, 143 PooledExecutor pool) 144 throws ResourceException { 145 return new TCPSManagedConnection(uri, socket, authenticator, pool); 146 } 147 148 } 149 | Popular Tags |