/// <summary> /// client authenticate over SSL/TLS with the server.<para/> /// the transport must be TcpClient. /// </summary> /// <param name="targetHost"> /// a string that indicates the name of the server that shares the SSL/TLS. /// </param> /// <param name="certificate"> /// a X509Certificate that specifies the certificate used to authenticate the client. /// </param> /// <param name="enabledSslProtocols"> /// The SslProtocols value that represents the protocol used for authentication. /// </param> /// <exception cref="ArgumentNullException"> /// thrown when certificate is null. /// </exception> /// <exception cref="ObjectDisposedException"> /// thrown when this object is disposed. /// </exception> /// <exception cref="InvalidOperationException"> /// thrown when client has connected to server, must startup ssl before Connect(). /// </exception> public void Startup(string targetHost, X509Certificate certificate, SslProtocols enabledSslProtocols) { if (disposed) { throw new ObjectDisposedException("TcpClientTransport"); } if (this.stream != null) { throw new InvalidOperationException( "client has connected to server, must startup ssl before Connect()."); } this.sslProvider = new ClientSslProvider(targetHost, certificate, enabledSslProtocols); }