示例#1
0
        public static void SslTest(string[] args)
        {
            var     str = new ByteBufferBidirectionalStream(64 * 1024 * 1024);
            Program p   = new Program();

            Thread serverThread = new Thread(p.ServerThreadMethod)
            {
                Name = "ServerThread"
            };
            Thread clientThread = new Thread(p.ClientThreadMethod)
            {
                Name = "clientThread"
            };

            clientThread.Start(str);
            serverThread.Start(str);

            serverThread.Join();
            clientThread.Join();

            Console.WriteLine("Remaining bytes in flight = " + Interlocked.Read(ref p._bytesInFlight));

            Console.WriteLine("Completed - press ENTER to continue");
            Console.ReadLine();
        }
示例#2
0
        public void SslTest()
        {
            var str = new ByteBufferBidirectionalStream(4 * 1024);  // test with small buffer

            Thread serverThread = new Thread(ServerThreadMethod)
            {
                Name = "ServerThread"
            };
            Thread clientThread = new Thread(ClientThreadMethod)
            {
                Name = "clientThread"
            };

            clientThread.Start(str);
            serverThread.Start(str);

            serverThread.Join();
            clientThread.Join();

            Assert.IsTrue(Interlocked.Read(ref _bytesInFlight) == 0, "SSL Stream's net bytes remaining != 0");
        }