示例#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);
        }
示例#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);
        }
示例#3
0
        public void TestBenchmarkIntegrated()
        {
            return;

            Logger.Console.Verbose = VerboseLevel.All;
            m_sw.Reset();

            var net = new NetworkStreamSimulator();

            var sa = new SecureStreamServer <NullToken>();

            sa.AddUserIntegratedSecurity("Zthe\\steven", new NullToken());
            ThreadPool.QueueUserWorkItem(ClientBenchmarkIntegrated, net.ClientStream);

            Stream stream;

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

            Thread.Sleep(100);
        }