Search in sources :

Example 1 with LoggingServerMessageListenerFactory

use of com.navercorp.pinpoint.rpc.server.LoggingServerMessageListenerFactory in project pinpoint by naver.

the class TcpDataSenderReconnectTest method connectAndSend.

@Test
public void connectAndSend() throws InterruptedException {
    TestPinpointServerAcceptor oldTestPinpointServerAcceptor = new TestPinpointServerAcceptor(new LoggingServerMessageListenerFactory(true));
    int bindPort = oldTestPinpointServerAcceptor.bind();
    PinpointClientFactory clientFactory = createPinpointClientFactory();
    TcpDataSender sender = new TcpDataSender(this.getClass().getName(), TestPinpointServerAcceptor.LOCALHOST, bindPort, clientFactory);
    oldTestPinpointServerAcceptor.assertAwaitClientConnected(5000);
    oldTestPinpointServerAcceptor.close();
    waitClientDisconnected(sender);
    logger.debug("Server start------------------");
    TestPinpointServerAcceptor newTestPinpointServerAcceptor = new TestPinpointServerAcceptor(new LoggingServerMessageListenerFactory(true));
    newTestPinpointServerAcceptor.bind(bindPort);
    newTestPinpointServerAcceptor.assertAwaitClientConnected(5000);
    logger.debug("sendMessage------------------");
    sender.send(new TApiMetaData("test", System.currentTimeMillis(), 1, "TestApi"));
    Thread.sleep(500);
    logger.debug("sender stop------------------");
    sender.stop();
    newTestPinpointServerAcceptor.close();
    clientFactory.release();
}
Also used : TApiMetaData(com.navercorp.pinpoint.thrift.dto.TApiMetaData) TestPinpointServerAcceptor(com.navercorp.pinpoint.test.server.TestPinpointServerAcceptor) PinpointClientFactory(com.navercorp.pinpoint.rpc.client.PinpointClientFactory) DefaultPinpointClientFactory(com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory) LoggingServerMessageListenerFactory(com.navercorp.pinpoint.rpc.server.LoggingServerMessageListenerFactory) Test(org.junit.Test)

Aggregations

DefaultPinpointClientFactory (com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory)1 PinpointClientFactory (com.navercorp.pinpoint.rpc.client.PinpointClientFactory)1 LoggingServerMessageListenerFactory (com.navercorp.pinpoint.rpc.server.LoggingServerMessageListenerFactory)1 TestPinpointServerAcceptor (com.navercorp.pinpoint.test.server.TestPinpointServerAcceptor)1 TApiMetaData (com.navercorp.pinpoint.thrift.dto.TApiMetaData)1 Test (org.junit.Test)1