Search in sources :

Example 1 with DefaultPinpointServer

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

the class PinpointClientStateTest method unexpectedCloseByPeerStateTest.

@Test
public void unexpectedCloseByPeerStateTest() throws InterruptedException {
    PinpointServerAcceptor serverAcceptor = null;
    PinpointClientFactory clientFactory = null;
    DefaultPinpointClientHandler handler = null;
    try {
        serverAcceptor = PinpointRPCTestUtils.createPinpointServerFactory(bindPort, PinpointRPCTestUtils.createEchoServerListener());
        clientFactory = PinpointRPCTestUtils.createClientFactory(PinpointRPCTestUtils.getParams(), PinpointRPCTestUtils.createEchoClientListener());
        handler = connect(clientFactory);
        assertHandlerState(SocketStateCode.RUN_DUPLEX, handler);
        List<PinpointSocket> pinpointServerList = serverAcceptor.getWritableSocketList();
        PinpointSocket pinpointServer = pinpointServerList.get(0);
        ((DefaultPinpointServer) pinpointServer).stop(true);
        assertHandlerState(SocketStateCode.UNEXPECTED_CLOSE_BY_SERVER, handler);
    } finally {
        closeHandler(handler);
        closeSocketFactory(clientFactory);
        PinpointRPCTestUtils.close(serverAcceptor);
    }
}
Also used : PinpointSocket(com.navercorp.pinpoint.rpc.PinpointSocket) PinpointServerAcceptor(com.navercorp.pinpoint.rpc.server.PinpointServerAcceptor) DefaultPinpointServer(com.navercorp.pinpoint.rpc.server.DefaultPinpointServer) Test(org.junit.Test)

Aggregations

PinpointSocket (com.navercorp.pinpoint.rpc.PinpointSocket)1 DefaultPinpointServer (com.navercorp.pinpoint.rpc.server.DefaultPinpointServer)1 PinpointServerAcceptor (com.navercorp.pinpoint.rpc.server.PinpointServerAcceptor)1 Test (org.junit.Test)1