protected override bool DoHandshake(SslStream clientSslStream, SslStream serverSslStream)
{
using (X509Certificate2 certificate = Configuration.Certificates.GetServerCertificate())
{
IAsyncResult a1 = clientSslStream.BeginAuthenticateAsClient(certificate.GetNameInfo(X509NameType.SimpleName, false), null, null);
IAsyncResult a2 = serverSslStream.BeginAuthenticateAsServer(certificate, null, null);
if (WaitHandle.WaitAll(new[] { a1.AsyncWaitHandle, a2.AsyncWaitHandle }, TestConfiguration.PassingTestTimeoutMilliseconds))
{
clientSslStream.EndAuthenticateAsClient(a1);
serverSslStream.EndAuthenticateAsServer(a2);
return true;
}
return false;
}
}
}