예제 #1
0
        void ClientBenchmarkDefault(object state)
        {
            Stream client = (Stream)state;
            var    sa     = new SecureStreamClientDefault();

            m_sw.Start();
            sa.TryAuthenticate(client, false);
            m_sw.Stop();
            System.Console.WriteLine(m_sw.Elapsed.TotalMilliseconds);

            m_sw.Restart();
            sa.TryAuthenticate(client);
            m_sw.Stop();
            System.Console.WriteLine(m_sw.Elapsed.TotalMilliseconds);

            m_sw.Restart();
            sa.TryAuthenticate(client, false);
            m_sw.Stop();
            System.Console.WriteLine(m_sw.Elapsed.TotalMilliseconds);

            m_sw.Restart();
            sa.TryAuthenticate(client);
            m_sw.Stop();
            System.Console.WriteLine(m_sw.Elapsed.TotalMilliseconds);

            m_sw.Restart();
            sa.TryAuthenticate(client, false);
            m_sw.Stop();
            System.Console.WriteLine(m_sw.Elapsed.TotalMilliseconds);
        }
예제 #2
0
        void ClientDefault(object state)
        {
            Stream client = (Stream)state;
            SecureStreamClientDefault sa = new SecureStreamClientDefault();

            if (!sa.TryAuthenticate(client, true, out Stream stream))
            {
                throw new Exception();
            }

            if (stream.ReadString() != "Message")
            {
                throw new Exception();
            }
            stream.Write("Response");
            stream.Flush();
            stream.Dispose();
        }
        void ClientDefault(object state)
        {
            Stream client = (Stream)state;
            var sa = new SecureStreamClientDefault();
            Stream stream;
            if (!sa.TryAuthenticate(client, true, out stream))
            {
                throw new Exception();
            }

            if (stream.ReadString() != "Message")
                throw new Exception();
            stream.Write("Response");
            stream.Flush();
            stream.Dispose();
        }
        void ClientBenchmarkDefault(object state)
        {
            Stream client = (Stream)state;
            var sa = new SecureStreamClientDefault();
            m_sw.Start();
            sa.TryAuthenticate(client, false);
            m_sw.Stop();
            System.Console.WriteLine(m_sw.Elapsed.TotalMilliseconds);

            m_sw.Restart();
            sa.TryAuthenticate(client);
            m_sw.Stop();
            System.Console.WriteLine(m_sw.Elapsed.TotalMilliseconds);

            m_sw.Restart();
            sa.TryAuthenticate(client, false);
            m_sw.Stop();
            System.Console.WriteLine(m_sw.Elapsed.TotalMilliseconds);

            m_sw.Restart();
            sa.TryAuthenticate(client);
            m_sw.Stop();
            System.Console.WriteLine(m_sw.Elapsed.TotalMilliseconds);

            m_sw.Restart();
            sa.TryAuthenticate(client, false);
            m_sw.Stop();
            System.Console.WriteLine(m_sw.Elapsed.TotalMilliseconds);
        }