Search in sources :

Example 1 with EchoClientListener

use of com.navercorp.pinpoint.rpc.util.PinpointRPCTestUtils.EchoClientListener in project pinpoint by naver.

the class ClientMessageListenerTest method clientMessageListenerTest1.

@Test
public void clientMessageListenerTest1() {
    TestPinpointServerAcceptor testPinpointServerAcceptor = new TestPinpointServerAcceptor(testServerMessageListenerFactory);
    int bindPort = testPinpointServerAcceptor.bind();
    EchoClientListener echoMessageListener = new EchoClientListener();
    TestPinpointClient testPinpointClient = new TestPinpointClient(echoMessageListener, PinpointRPCTestUtils.getParams());
    try {
        testPinpointClient.connect(bindPort);
        testPinpointServerAcceptor.assertAwaitClientConnected(1, 1000);
        PinpointSocket writableServer = testPinpointServerAcceptor.getConnectedPinpointSocketList().get(0);
        assertSendMessage(writableServer, "simple", echoMessageListener);
        assertRequestMessage(writableServer, "request", echoMessageListener);
    } finally {
        testPinpointClient.closeAll();
        testPinpointServerAcceptor.close();
    }
}
Also used : TestPinpointServerAcceptor(com.navercorp.pinpoint.test.server.TestPinpointServerAcceptor) TestPinpointClient(com.navercorp.pinpoint.test.client.TestPinpointClient) PinpointSocket(com.navercorp.pinpoint.rpc.PinpointSocket) EchoClientListener(com.navercorp.pinpoint.rpc.util.PinpointRPCTestUtils.EchoClientListener) Test(org.junit.Test)

Aggregations

PinpointSocket (com.navercorp.pinpoint.rpc.PinpointSocket)1 EchoClientListener (com.navercorp.pinpoint.rpc.util.PinpointRPCTestUtils.EchoClientListener)1 TestPinpointClient (com.navercorp.pinpoint.test.client.TestPinpointClient)1 TestPinpointServerAcceptor (com.navercorp.pinpoint.test.server.TestPinpointServerAcceptor)1 Test (org.junit.Test)1