Ejemplo n.º 1
0
        public void TestDefault()
        {
            Logger.Console.Verbose = VerboseLevel.All;
            m_sw.Reset();

            var net = new NetworkStreamSimulator();
            var sa  = new SecureStreamServer <NullToken>();

            sa.SetDefaultUser(true, new NullToken());
            ThreadPool.QueueUserWorkItem(ClientDefault, net.ClientStream);

            Stream stream;

            if (!sa.TryAuthenticateAsServer(net.ServerStream, true, out stream, out T))
            {
                throw new Exception();
            }

            stream.Write("Message");
            stream.Flush();
            if (stream.ReadString() != "Response")
            {
                throw new Exception();
            }
            stream.Dispose();

            Thread.Sleep(100);
        }
Ejemplo n.º 2
0
        public void TestBenchmarkDefault()
        {
            Logger.Console.Verbose = VerboseLevel.All;
            m_sw.Reset();

            NetworkStreamSimulator net = new NetworkStreamSimulator();

            SecureStreamServer <NullToken> sa = new SecureStreamServer <NullToken>();

            sa.SetDefaultUser(true, new NullToken());
            ThreadPool.QueueUserWorkItem(ClientBenchmarkDefault, net.ClientStream);

            sa.TryAuthenticateAsServer(net.ServerStream, false, out Stream stream, out T);
            sa.TryAuthenticateAsServer(net.ServerStream, true, out stream, out T);
            sa.TryAuthenticateAsServer(net.ServerStream, false, out stream, out T);
            sa.TryAuthenticateAsServer(net.ServerStream, true, out stream, out T);
            sa.TryAuthenticateAsServer(net.ServerStream, false, out stream, out T);

            Thread.Sleep(100);
        }