コード例 #1
0
        public void InvalidPasswordUsingTcpSimplexChannel()
        {
            var url         = "tcp://localhost:8091/CustomAuthenticationTestHost_TcpSimplex";
            var protocol    = new TcpCustomClientProtocolSetup(true);
            var credentials = new SrpCredentials(UserName, Password + "1", CustomSrpParameters);

            try
            {
                new ZyanConnection(url, protocol, credentials, true, true);
            }
            catch (SecurityException ex)
            {
                Assert.AreEqual("Authentication failed: bad password or user name", ex.Message);
            }
        }
コード例 #2
0
        public void ValidLoginUsingTcpSimplexChannel()
        {
            var url         = "tcp://localhost:8091/CustomAuthenticationTestHost_TcpSimplex";
            var protocol    = new TcpCustomClientProtocolSetup(true);
            var credentials = new SrpCredentials(UserName, Password, CustomSrpParameters);

            using (var connection = new ZyanConnection(url, protocol, credentials, true, true))
            {
                var proxy1 = connection.CreateProxy <ISampleServer>("SampleServer");
                Assert.AreEqual("Hallo", proxy1.Echo("Hallo"));
                proxy1 = null;
            }

            // reconnect
            using (var connection = new ZyanConnection(url, protocol, credentials, true, true))
            {
                var proxy2 = connection.CreateProxy <ISampleServer>("SampleServer");
                Assert.AreEqual("Hallo", proxy2.Echo("Hallo"));
            }
        }