void runPullTest() throws Exception {

        final String message = "hello rabbit mq";

        // producer side
        final Connection producerConnection = connectionFactory.newConnection();
        final Channel producerChannel = producerConnection.createChannel();

        producerChannel.exchangeDeclare(RabbitMQTestConstants.EXCHANGE, "direct", false);
        producerChannel.queueDeclare(RabbitMQTestConstants.QUEUE_PULL, false, false, false, null);
        producerChannel.queueBind(RabbitMQTestConstants.QUEUE_PULL, RabbitMQTestConstants.EXCHANGE, RabbitMQTestConstants.ROUTING_KEY_PULL);

        AMQP.BasicProperties.Builder builder = new AMQP.BasicProperties.Builder();
        producerChannel.basicPublish(RabbitMQTestConstants.EXCHANGE, RabbitMQTestConstants.ROUTING_KEY_PULL, false, false, builder.appId("test").build(), message.getBytes());

        producerChannel.close();
        producerConnection.close();

        //comsumer side
        final Connection consumerConnection = connectionFactory.newConnection();
        final Channel consumerChannel = consumerConnection.createChannel();
        final String remoteAddress = consumerConnection.getAddress().getHostAddress() + ":" + consumerConnection.getPort();

        TestMessagePuller messagePuller = new TestMessagePuller(consumerChannel);
        Assertions.assertEquals(messagePuller.pullMessage(MessageConverter.FOR_TEST, RabbitMQTestConstants.QUEUE_PULL, true), message);

        consumerChannel.close();
        consumerConnection.close();

        PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
        // Wait till all traces are recorded (consumer traces are recorded from another thread)
        awaitAndVerifyTraceCount(verifier, 5, 5000L);

        verifier.printCache();
        // verify producer traces
        Class<?> producerChannelClass = producerChannel.getClass();
        Method channelBasicPublish = producerChannelClass.getDeclaredMethod("basicPublish", String.class, String.class, boolean.class, boolean.class, AMQP.BasicProperties.class, byte[].class);
        ExpectedTrace channelBasicPublishTrace = Expectations.event(
                RabbitMQTestConstants.RABBITMQ_CLIENT, // serviceType
                channelBasicPublish, // method
                null, // rpc
                remoteAddress, // endPoint
                "exchange-" + RabbitMQTestConstants.EXCHANGE, // destinationId
                Expectations.annotation("rabbitmq.exchange", RabbitMQTestConstants.EXCHANGE),
                Expectations.annotation("rabbitmq.routingkey", RabbitMQTestConstants.ROUTING_KEY_PULL));
        ExpectedTrace rabbitMqConsumerInvocationTrace = Expectations.root(
                RabbitMQTestConstants.RABBITMQ_CLIENT, // serviceType
                "RabbitMQ Consumer Invocation", // method
                "rabbitmq://exchange=" + RabbitMQTestConstants.EXCHANGE, // rpc
                null, // endPoint (collected but API to retrieve local address is not available in all versions, so skip)
                remoteAddress, // remoteAddress
                Expectations.annotation("rabbitmq.routingkey", RabbitMQTestConstants.ROUTING_KEY_PULL));
        Class<?> amqChannelClass = Class.forName("com.rabbitmq.client.impl.AMQChannel");
        Method handleCompleteInboundCommand = amqChannelClass.getDeclaredMethod("handleCompleteInboundCommand", AMQCommand.class);
        ExpectedTrace handleCompleteInboundCommandTrace = Expectations.event(
                RabbitMQTestConstants.RABBITMQ_CLIENT_INTERNAL, // serviceType
                handleCompleteInboundCommand); // method
        ExpectedTrace[] producerTraces = {channelBasicPublishTrace};
        ExpectedTrace[] consumerTraces = {rabbitMqConsumerInvocationTrace, handleCompleteInboundCommandTrace};
        verifier.verifyDiscreteTrace(producerTraces);
        verifier.verifyDiscreteTrace(consumerTraces);

        // verify consumer traces
        Class<?> consumerChannelClass = consumerChannel.getClass();
        Method channelBasicGet = consumerChannelClass.getDeclaredMethod("basicGet", String.class, boolean.class);
        ExpectedTrace channelBasicGetTrace = Expectations.event(
                RabbitMQTestConstants.RABBITMQ_CLIENT_INTERNAL,
                channelBasicGet);
        Class<?> propagationMarkerClass = PropagationMarker.class;
        Method propagationMarkerMark = propagationMarkerClass.getDeclaredMethod("mark");
        ExpectedTrace markTrace = Expectations.event(
                INTERNAL_METHOD,
                propagationMarkerMark);
        verifier.verifyDiscreteTrace(
                channelBasicGetTrace,
                markTrace);
        verifier.verifyTraceCount(0);
    }
@author Jiaqi Feng
@author HyunGil Jeong
agent-module/plugins-it/rabbitmq-it/src/test/java/com/navercorp/pinpoint/it/plugin/rabbitmq/RabbitMQTestRunner.java