use of com.navercorp.pinpoint.test.server.TestServerMessageListenerFactory in project pinpoint by naver.
the class PinpointClientFactoryTest method requestAndResponse.
@Test
public void requestAndResponse() throws IOException, InterruptedException {
TestPinpointServerAcceptor testPinpointServerAcceptor = new TestPinpointServerAcceptor(new TestServerMessageListenerFactory(TestServerMessageListenerFactory.HandshakeType.DUPLEX));
int bindPort = testPinpointServerAcceptor.bind();
try {
PinpointClient client = clientFactory.connect("127.0.0.1", bindPort);
byte[] randomByte = TestByteUtils.createRandomByte(20);
byte[] response = PinpointRPCTestUtils.request(client, randomByte);
Assert.assertArrayEquals(randomByte, response);
PinpointRPCTestUtils.close(client);
} finally {
testPinpointServerAcceptor.close();
}
}
Aggregations