Exemplo n.º 1
0
		public ClientRecordProtocol(
			Stream			innerStream, 
			ClientContext	context) : base(innerStream, context)
		{
		}
		public SslClientStream(
			Stream						stream,
			string						targetHost,
			bool						ownsStream,
			SecurityProtocolType		securityProtocolType,
			X509CertificateCollection	clientCertificates)
		{
			if (stream == null)
			{
				throw new ArgumentNullException("stream is null.");
			}
			if (!stream.CanRead || !stream.CanWrite)
			{
				throw new ArgumentNullException("stream is not both readable and writable.");
			}
			if (targetHost == null || targetHost.Length == 0)
			{
				throw new ArgumentNullException("targetHost is null or an empty string.");
			}

			this.context = new ClientContext(
				this,
				securityProtocolType, 
				targetHost, 
				clientCertificates);

			this.inputBuffer	= new MemoryStream();
			this.innerStream	= stream;
			this.ownsStream		= ownsStream;
			this.negotiate			= new object ();
			this.read			= new object ();
			this.write			= new object ();
			this.protocol		= new ClientRecordProtocol(innerStream, context);
		}