def test_cannot_send_after_connection_is_closed():
    connection = Connection(ADDR, fake_socket, Mock())
    connection.close()
    with pytest.raises(Exception, match='Connection closed'):
        connection.send(b'')
def test_state_is_changed_to_closed_when_close_is_called():
    connection = Connection(ADDR, fake_socket, Mock())
    connection.close()

    assert connection.state == Connection.CLOSED