Beispiel #1
0
    def setUp(self):
        self.server = TcpServer("", 10000)
        self.client = TcpClient("localhost", 10000)

        self.server.start()
        self.client.start()
        pass
Beispiel #2
0
class TestTcpCommunication(unittest.TestCase):
    def setUp(self):
        self.server = TcpServer("", 10000)
        self.client = TcpClient("localhost", 10000)

        self.server.start()
        self.client.start()
        pass

    def tearDown(self):
        self.client.stop()
        self.server.stop()

    def test_tcp_communication(self):
        for i in range(1, 50):
            self.server.write("server #%d" % i)
            time.sleep(1)

        for i in range(1, 50):
            self.client.write("client #%d" % i)
            time.sleep(1)