public IAsyncResult BeginClientHandshake(string targetHost,
AsyncCallback asyncCallback,
Object asyncState)
{
lock (_handshakeLock) {
if (_isHandshaking) {
throw new InvalidOperationException("Handshake already in progress");
}
if (_isAuthenticated) {
throw new InvalidOperationException("Renegotiation not supported");
}
_recordHandler = new RecordHandler(_securityParameters.MinimumVersion, true);
_handshakeSession = new ClientHandshakeSession(_securityParameters);
_isHandshaking = true;
}
AsyncHandshakeResult asyncHandshakeResult = new AsyncHandshakeResult(asyncCallback, asyncState);
ProcessSendHandshakePacket(asyncHandshakeResult);
return asyncHandshakeResult;
}