1
2import pytest
3
4
5async def test_basic(service_client, asyncio_socket, tcp_service_port):
6 sock = asyncio_socket.tcp()
7 await sock.connect(('localhost', tcp_service_port))
8
9 await sock.sendall(b'hi')
10 hello = await sock.recv(5)
11 assert hello == b'hello'
12
13 await sock.sendall(b'whats up?')
14 with pytest.raises(ConnectionResetError):
15 await sock.recv(1)
16