public TlsHandler(Func <Stream, SslStream> sslStreamFactory, TlsSettings settings) { Contract.Requires(sslStreamFactory != null); Contract.Requires(settings != null); this.settings = settings; this.closeFuture = new TaskCompletionSource(); this.mediationStream = new MediationStream(this); this.sslStream = sslStreamFactory(this.mediationStream); }
TlsHandler(bool isServer, X509Certificate2 certificate, string targetHost, RemoteCertificateValidationCallback certificateValidationCallback) { Contract.Requires(!isServer || certificate != null); Contract.Requires(isServer || !string.IsNullOrEmpty(targetHost)); this.sslStreamWriteQueue = new Queue<TaskCompletionSource<int>>(); this.isServer = isServer; this.certificate = certificate; this.targetHost = targetHost; this.mediationStream = new MediationStream(this); this.sslStream = new SslStream(this.mediationStream, true, certificateValidationCallback); }
TlsHandler(bool isServer, X509Certificate2 certificate, string targetHost, RemoteCertificateValidationCallback certificateValidationCallback) { Contract.Requires(!isServer || certificate != null); Contract.Requires(isServer || !string.IsNullOrEmpty(targetHost)); this.sslStreamWriteQueue = new Queue <TaskCompletionSource <int> >(); this.isServer = isServer; this.certificate = certificate; this.targetHost = targetHost; this.mediationStream = new MediationStream(this); this.sslStream = new SslStream(this.mediationStream, true, certificateValidationCallback); }