System.Net.Security.Tests.DummyTcpServer.OnAuthenticate C# (CSharp) Method

OnAuthenticate() private method

private OnAuthenticate ( Task result, ClientState state ) : void
result Task
state ClientState
return void
        private void OnAuthenticate(Task result, ClientState state)
        {
            SslStream sslStream = (SslStream)state.Stream;

            try
            {
                result.GetAwaiter().GetResult();
                _log.WriteLine("Server authenticated to client with encryption cipher: {0} {1}-bit strength",
                    sslStream.CipherAlgorithm, sslStream.CipherStrength);

                // Start listening for data from the client connection.
                sslStream.BeginRead(state.ReceiveBuffer, 0, state.ReceiveBuffer.Length, OnReceive, state);
            }
            catch (AuthenticationException authEx)
            {
                _log.WriteLine(
                    "Server disconnecting from client during authentication.  No shared SSL/TLS algorithm. ({0})",
                    authEx);
                state.Dispose();
            }
            catch (Exception ex)
            {
                _log.WriteLine("Server disconnecting from client during authentication.  Exception: {0}",
                    ex.Message);
                state.Dispose();
            }
        }