use of com.navercorp.pinpoint.rpc.server.PinpointServerAcceptor in project pinpoint by naver.
the class ReconnectTest method serverFirstClose.
@Test
public void serverFirstClose() throws IOException, InterruptedException {
// when abnormal case in which server has been closed first, confirm that a socket should be closed properly.
PinpointServerAcceptor serverAcceptor = PinpointRPCTestUtils.createPinpointServerFactory(bindPort);
PinpointClient client = clientFactory.connect("127.0.0.1", bindPort);
byte[] randomByte = TestByteUtils.createRandomByte(10);
Future<ResponseMessage> response = client.request(randomByte);
response.await();
try {
response.getResult();
} catch (Exception e) {
logger.debug("timeout.", e);
}
// close server by force
PinpointRPCTestUtils.close(serverAcceptor);
assertClientDisconnected(client);
PinpointRPCTestUtils.close(client);
}
use of com.navercorp.pinpoint.rpc.server.PinpointServerAcceptor in project pinpoint by naver.
the class ClientMessageListenerTest method clientMessageListenerTest2.
@Test
public void clientMessageListenerTest2() throws InterruptedException {
PinpointServerAcceptor serverAcceptor = PinpointRPCTestUtils.createPinpointServerFactory(bindPort, SimpleServerMessageListener.DUPLEX_INSTANCE);
EchoClientListener echoMessageListener1 = PinpointRPCTestUtils.createEchoClientListener();
PinpointClientFactory clientSocketFactory1 = PinpointRPCTestUtils.createClientFactory(PinpointRPCTestUtils.getParams(), echoMessageListener1);
EchoClientListener echoMessageListener2 = PinpointRPCTestUtils.createEchoClientListener();
PinpointClientFactory clientSocketFactory2 = PinpointRPCTestUtils.createClientFactory(PinpointRPCTestUtils.getParams(), echoMessageListener2);
try {
PinpointClient client = clientSocketFactory1.connect("127.0.0.1", bindPort);
PinpointClient client2 = clientSocketFactory2.connect("127.0.0.1", bindPort);
assertAvaiableWritableSocket(serverAcceptor, 2);
List<PinpointSocket> writableServerList = serverAcceptor.getWritableSocketList();
PinpointSocket writableServer = writableServerList.get(0);
assertRequestMessage(writableServer, "socket1", null);
PinpointSocket writableServer2 = writableServerList.get(1);
assertRequestMessage(writableServer2, "socket2", null);
Assert.assertEquals(1, echoMessageListener1.getRequestPacketRepository().size());
Assert.assertEquals(1, echoMessageListener2.getRequestPacketRepository().size());
PinpointRPCTestUtils.close(client, client2);
} finally {
clientSocketFactory1.release();
clientSocketFactory2.release();
PinpointRPCTestUtils.close(serverAcceptor);
}
}
use of com.navercorp.pinpoint.rpc.server.PinpointServerAcceptor in project pinpoint by naver.
the class PinpointClientFactoryTest method pingAndRequestResponse.
@Test
public void pingAndRequestResponse() throws IOException, InterruptedException {
PinpointServerAcceptor serverAcceptor = PinpointRPCTestUtils.createPinpointServerFactory(bindPort, SimpleServerMessageListener.DUPLEX_ECHO_INSTANCE);
try {
PinpointClient client = clientFactory.connect("127.0.0.1", bindPort);
byte[] randomByte = TestByteUtils.createRandomByte(10);
byte[] response = PinpointRPCTestUtils.request(client, randomByte);
Assert.assertArrayEquals(randomByte, response);
PinpointRPCTestUtils.close(client);
} finally {
PinpointRPCTestUtils.close(serverAcceptor);
}
}
use of com.navercorp.pinpoint.rpc.server.PinpointServerAcceptor in project pinpoint by naver.
the class PinpointClientFactoryTest method ping.
@Test
public void ping() throws IOException, InterruptedException {
PinpointServerAcceptor serverAcceptor = PinpointRPCTestUtils.createPinpointServerFactory(bindPort);
try {
PinpointClient client = clientFactory.connect("127.0.0.1", bindPort);
client.sendPing();
PinpointRPCTestUtils.close(client);
} finally {
PinpointRPCTestUtils.close(serverAcceptor);
}
}
use of com.navercorp.pinpoint.rpc.server.PinpointServerAcceptor in project pinpoint by naver.
the class PinpointClientFactoryTest method connect.
@Test
public void connect() throws IOException, InterruptedException {
PinpointServerAcceptor serverAcceptor = PinpointRPCTestUtils.createPinpointServerFactory(bindPort);
try {
PinpointClient client = clientFactory.connect("127.0.0.1", bindPort);
PinpointRPCTestUtils.close(client);
} finally {
PinpointRPCTestUtils.close(serverAcceptor);
}
}
Aggregations