Example #1
0
        public void ServerDisconnectMessageTest()
        {
            var port = PortProvider.ProviderPort();

            ManualResetEvent     dataReceivedEvent = new ManualResetEvent(false);
            DisconnectTestServer server            = new DisconnectTestServer(delegate {
                dataReceivedEvent.Set();
            }, "0.0.0.0", port);

            server.StartAsync();
            var client = TestClient.Builder.Create("127.0.0.1", port).Build();

            //we need to wait for connection
            //to initialize before it can be
            //stopped and get message
            client.Run().Wait();
            client.Stop();

            if (!dataReceivedEvent.WaitOne(5000))
            {
                Assert.Fail("Message timeout");
            }

            dataReceivedEvent.Reset();
        }
Example #2
0
        public void MiddlewaresExecutionOrderTest()
        {
            var server = new MiddlewareTestServer("0.0.0.0", PortProvider.ProviderPort());

            ServerTester.PlayCommonServerTest(server);

            Assert.AreEqual(new int[] { 3, 2, 1 }, server.result.ToArray());
        }
Example #3
0
        public void AgentMessageTest()
        {
            var receiverServerPort = PortProvider.ProviderPort();
            var senderServerPort   = PortProvider.ProviderPort();

            var messageToSend = TestMessages.TestMessageType1Sample1();

            ManualResetEvent       dataReceivedEvent = new ManualResetEvent(false);
            AgentPassingTestServer receiverServer    = new AgentPassingTestServer(delegate(TestMessages.TestMessageType1 message) {
                Assert.AreEqual(messageToSend, message);
                dataReceivedEvent.Set();
            }, "0.0.0.0", receiverServerPort, default, 0);
Example #4
0
 public void SslServerMessagePassingTest()
 {
     ServerTester.PlayCommonServerTest(new SslTestServer("0.0.0.0", PortProvider.ProviderPort()), delegate(TestClient.Builder builder) {
         builder.SslEnabled(true);
     });
 }
Example #5
0
 public void ClientToServerMessagePassingTest()
 {
     ServerTester.PlayCommonServerTest(new ServerTester.TestServer("0.0.0.0", PortProvider.ProviderPort()));
 }