예제 #1
0
        public void Starts_and_stops_multiple_times()
        {
            Assert.IsTrue(server.IsStarted);
            Assert.IsTrue(Helpers.IsTcpPortListening(SERVER_PORT), "Port should be open when server has started.");
            var serverPollThread = server._pollThread;

            server.Stop();
            Assert.IsFalse(server.IsStarted);
            Assert.IsFalse(Helpers.IsTcpPortListening(SERVER_PORT), "Port should be closed when server has stopped.");
            Assert.AreEqual(System.Threading.ThreadState.Aborted, serverPollThread.ThreadState, "Polling thread stops when server stops.");

            server.Start(SERVER_PORT);
            Assert.IsTrue(server.IsStarted);
            Assert.IsTrue(Helpers.IsTcpPortListening(SERVER_PORT), "Port should be open when server has started.");
        }
예제 #2
0
        public MessagingTests()
        {
            server = new Server.TcpServer();
            server.Start(SERVER_PORT);

            var serverAddress = new IPAddress(new byte[] { 127, 0, 0, 1 });

            client = TcpClient.Connect(serverAddress, SERVER_PORT);
        }
예제 #3
0
 public TcpServerTests()
 {
     Assert.IsFalse(Helpers.IsTcpPortListening(SERVER_PORT), "Port should be closed at start of test.");
     server = new Server.TcpServer();
     server.Start(SERVER_PORT);
 }
예제 #4
0
 public TcpClientTests()
 {
     server = new Server.TcpServer();
     server.Start(SERVER_PORT);
 }
예제 #5
0
 public ConnectionTests()
 {
     server = new Server.TcpServer();
     server.Start(SERVER_PORT);
 }