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."); }
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); }
public TcpServerTests() { Assert.IsFalse(Helpers.IsTcpPortListening(SERVER_PORT), "Port should be closed at start of test."); server = new Server.TcpServer(); server.Start(SERVER_PORT); }
public TcpClientTests() { server = new Server.TcpServer(); server.Start(SERVER_PORT); }
public ConnectionTests() { server = new Server.TcpServer(); server.Start(SERVER_PORT); }