public async Task Close() { if (_sslStream != null) { _sslStream.Dispose(); } if (_rawStream != null) { _rawStream.Dispose(); } try { await _socket.AsyncDisconnect(); } finally { _socket.Close(); } }