public async Task Connect() { await _physicalConnection.Connect(_clientOptions).ConfigureAwait(false); var greetingsResponseBytes = new byte[128]; var readCount = await _physicalConnection.ReadAsync(greetingsResponseBytes, 0, greetingsResponseBytes.Length).ConfigureAwait(false); if (readCount != greetingsResponseBytes.Length) { throw ExceptionHelper.UnexpectedGreetingBytesCount(readCount); } var greetings = new GreetingsResponse(greetingsResponseBytes); _clientOptions.LogWriter?.WriteLine($"Greetings received, salt is {Convert.ToBase64String(greetings.Salt)} ."); PingsFailedByTimeoutCount = 0; _responseReader.BeginReading(); _requestWriter.BeginWriting(); _clientOptions.LogWriter?.WriteLine("Server responses reading started."); await LoginIfNotGuest(greetings).ConfigureAwait(false); }