示例#1
0
        public void Test()
        {
            ISocket4Factory sslSocketFactory = new SslSocketFactory(new StandardSocket4Factory(), ServerCertificate());
            IServerSocket4  serverSocket     = sslSocketFactory.CreateServerSocket(0);

            PassThroughSocketFactory clientEncryptedContentsSocketFactory = NewPassThroughSocketFactory();
            PassThroughSocketFactory clientPassThroughSocketFactory       = new PassThroughSocketFactory(new SslSocketFactory(clientEncryptedContentsSocketFactory, ValidateServerCertificate));

            Thread clientThread = StartClient(serverSocket.GetLocalPort(), clientPassThroughSocketFactory);

            string msg = ReadString(serverSocket.Accept());

            Assert.AreEqual(Message, msg);
            AssertAreNotEqual(clientEncryptedContentsSocketFactory.LastClient.Written, clientPassThroughSocketFactory.LastClient.Written);

            clientThread.Join();
        }
示例#2
0
		public void Test()
		{
			ISocket4Factory sslSocketFactory = new SslSocketFactory(new StandardSocket4Factory(), ServerCertificate());
			IServerSocket4 serverSocket = sslSocketFactory.CreateServerSocket(0);

			PassThroughSocketFactory clientEncryptedContentsSocketFactory = NewPassThroughSocketFactory();
			PassThroughSocketFactory clientPassThroughSocketFactory = new PassThroughSocketFactory(new SslSocketFactory(clientEncryptedContentsSocketFactory, ValidateServerCertificate));

			Thread clientThread = StartClient(serverSocket.GetLocalPort(), clientPassThroughSocketFactory);

			string msg = ReadString(serverSocket.Accept());

			Assert.AreEqual(Message, msg);
			AssertAreNotEqual(clientEncryptedContentsSocketFactory.LastClient.Written, clientPassThroughSocketFactory.LastClient.Written);

			clientThread.Join();
		}