private Socket getTLSSocket ( InetAddress destination , int port ) throws Exception { String key = destination . getHostAddress ( ) + ":" + port ; synchronized ( socketMap ) { Socket socket = socketMap . get ( key ) ; if ( socket == null ) { // create a new one NodeAuthModuleContext nodeAuthContext = NodeAuthModuleContext . getContext ( ) ; socket = nodeAuthContext . getSocketHandler ( ) . getSocket ( destination . getHostName ( ) , port , true ) ; // remember it for next time // TODO: had trouble with this with Steve Moore's online ATNA server so not caching the sockets // need to worry about synchronization if we try to put this optimization back // there appears to be one AuditorModuleContext per host/port so may can pool them based on that object? socketMap . put ( key , socket ) ; } // whatever happened, now return the socket return socket ; } }
Gets the socket tied to the address and port for this transport