final Integer receiveBufferSize = _config.getReceiveBufferSize();
socket.setSendBufferSize(sendBufferSize);
socket.setReceiveBufferSize(receiveBufferSize);
ProtocolEngine engine = _factory.newProtocolEngine();
final IdleTimeoutTicker ticker = new IdleTimeoutTicker(engine, TIMEOUT);
NetworkConnection connection = new IoNetworkConnection(socket, engine, sendBufferSize, receiveBufferSize, _timeout,
ticker);
connection.setMaxReadIdle(HANSHAKE_TIMEOUT);
ticker.setConnection(connection);
if(_sslContext != null && socket instanceof SSLSocket)
{
try
{
Principal peerPrincipal = ((SSLSocket) socket).getSession().getPeerPrincipal();
connection.setPeerPrincipal(peerPrincipal);
}
catch(SSLPeerUnverifiedException e)
{
// ignore
}
}
engine.setNetworkConnection(connection, connection.getSender());
connection.start();
}
catch(RuntimeException e)
{