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);
}
}
Aggregations