void StartAuthentication(object state)
{
var result = state as AuthenticateResult;
m_TlsHandler = new TlsProtocolHandler(m_InnerStream);
try
{
m_TlsHandler.Connect(new LegacyTlsClient(new AlwaysValidVerifyer()));
m_SecureStream = m_TlsHandler.Stream;
}
catch (Exception e)
{
result.Exception = e;
}
finally
{
result.IsCompleted = true;
var callback = result.Callback;
if (callback != null)
callback(result);
}
}