Exemplo n.º 1
0
        public void TestConnect15()
        {
            var clientAuthenticator = new Test2Authenticator();

            using (var client = CreateClient(name: "Rep1", clientAuthenticator: clientAuthenticator, serverAuthenticator: new TestAuthenticator()))
                using (var server = CreateServer(name: "Rep2", clientAuthenticator: clientAuthenticator, serverAuthenticator: new Test2Authenticator()))
                {
                    Bind(server);
                    new Action(() => Connect(client, server.LocalEndPoint, TimeSpan.FromSeconds(10)))
                    .ShouldThrow <AuthenticationException>();
                    server.IsConnected.Should().BeFalse();
                    client.IsConnected.Should().BeFalse();
                }
        }
Exemplo n.º 2
0
        public void TestTryConnect13()
        {
            var clientAuthenticator = new Test2Authenticator();
            var serverAuthenticator = new TestAuthenticator();

            using (var client = CreateClient(name: "Rep1", clientAuthenticator: clientAuthenticator, serverAuthenticator: serverAuthenticator))
                using (var server = CreateServer(name: "Rep2", clientAuthenticator: clientAuthenticator, serverAuthenticator: serverAuthenticator))
                {
                    Bind(server);
                    bool success = false;
                    new Action(() => success = TryConnect(client, server.LocalEndPoint, TimeSpan.FromSeconds(10))).ShouldNotThrow();
                    server.IsConnected.Should().BeTrue();
                    client.IsConnected.Should().BeTrue();
                }
        }