public TcpConnection(TcpAddress localAddress, TcpAddress remoteAddress, Socket socket, IConnectionUtility connectionUtility, IEncryptionManager encryptionManager) { RemoteAddress = remoteAddress; this.localAddress = localAddress; this.socket = socket; this.connectionUtility = connectionUtility; stream = new NonblockingSocketStream(socket, connectionUtility, encryptionManager.CreateEncoder(this)); State = ConnectionState.Connecting; }