Beispiel #1
0
def test_send_receive_with_none_context():
    server = TCPServer(name='server', host='localhost', port=0)

    client = TCPClient(name='client',
                       host=context('server', '{{host}}'),
                       port=context('server', '{{port}}'))
    assert server.port is None
    server.start()
    server._wait_started()
    assert server.port != 0
    should_raise(ValueError, client.start)
    server.stop()
    server._wait_stopped()
Beispiel #2
0
def test_send_receive_no_context():
    server = TCPServer(name='server', host='localhost', port=0)
    assert server.port is None
    server.start()
    server._wait_started()
    assert server.port != 0

    client = TCPClient(name='client', host=server._host, port=server._port)
    client.start()
    client._wait_started()

    send_receive_message(server, client)
    client.stop()
    client._wait_stopped()
    server.stop()
    server._wait_stopped()