public SocketEntry(TcpAddress address, Socket socket, boolean useClientMode, TransportStateReference tmStateReference) throws NoSuchAlgorithmException { this.inAppBuffer = ByteBuffer.allocate(getMaxInboundMessageSize()); this.inNetBuffer = ByteBuffer.allocate(getMaxInboundMessageSize()); this.outNetBuffer = ByteBuffer.allocate(getMaxInboundMessageSize()); this.peerAddress = address; this.tmStateReference = tmStateReference; this.socket = socket; this.lastUse = System.nanoTime(); if (tmStateReference == null) { counterSupport.fireIncrementCounter(new CounterEvent(this, SnmpConstants.snmpTlstmSessionAccepts)); } SSLContext sslContext = sslEngineConfigurator.getSSLContext(useClientMode, tmStateReference); this.sslEngine = sslContext.createSSLEngine(address.getInetAddress().getHostName(), address.getPort()); sslEngine.setUseClientMode(useClientMode); // sslEngineConfigurator.configure(SSLContext.getDefault(), useClientMode); sslEngineConfigurator.configure(sslEngine); synchronized (TLSTM.this) { sessionID = nextSessionID++; } }
public SocketEntry(TcpAddress address, Socket socket, boolean useClientMode, TransportStateReference tmStateReference) throws NoSuchAlgorithmException { super(address, socket); this.inAppBuffer = ByteBuffer.allocate(getMaxInboundMessageSize()); this.inNetBuffer = ByteBuffer.allocate(getMaxInboundMessageSize()); this.outNetBuffer = ByteBuffer.allocate(getMaxInboundMessageSize()); this.tmStateReference = tmStateReference; if (tmStateReference == null) { counterSupport.fireIncrementCounter(new CounterEvent(this, SnmpConstants.snmpTlstmSessionAccepts)); } SSLEngineConfigurator sslEngineConfigurator = ensureSslEngineConfigurator(); SSLContext sslContext = sslEngineConfigurator.getSSLContext(useClientMode, tmStateReference); this.sslEngine = sslContext.createSSLEngine(address.getInetAddress().getHostName(), address.getPort()); sslEngine.setUseClientMode(useClientMode); sslEngineConfigurator.configure(sslEngine); synchronized (TLSTM.this) { sessionID = nextSessionID++; } }