def test_request_response(connection, receiver):
    """
    Test request/response messaging pattern.
    """

    def endpoint_callback(message):
        return message.payload + "-pong"

    connection.register_async_endpoint(endpoint_callback, "test.request")
    connection.call_async(receiver.create_cbf(), "test.request", "ping")

    assert ["ping-pong"] == receiver.wait_for_messages()