use of com.navercorp.pinpoint.rpc.DiscardServerHandler in project pinpoint by naver.
the class PinpointServerSocketTest method testBind.
@Test
public void testBind() throws Exception {
TestPinpointServerAcceptor testPinpointServerAcceptor = new TestPinpointServerAcceptor(new DiscardServerHandler());
int bindPort = testPinpointServerAcceptor.bind();
Socket socket = new Socket("127.0.0.1", bindPort);
socket.getOutputStream().write(new byte[0]);
socket.getOutputStream().flush();
socket.close();
Thread.sleep(1000);
testPinpointServerAcceptor.close();
}
use of com.navercorp.pinpoint.rpc.DiscardServerHandler in project pinpoint by naver.
the class PipelineFactoryTest method testBind.
@Test
public void testBind() throws Exception {
PinpointServerAcceptor serverAcceptor = null;
Socket socket = null;
try {
serverAcceptor = new PinpointServerAcceptor(ChannelFilter.BYPASS, new TestPipelineFactory());
final DiscardServerHandler discardServerHandler = new DiscardServerHandler();
serverAcceptor.setMessageHandler(discardServerHandler);
serverAcceptor.bind("127.0.0.1", bindPort);
socket = new Socket("127.0.0.1", bindPort);
socket.getOutputStream().write((START_KEY + "Test").getBytes());
socket.getOutputStream().flush();
assertMessageReceivedCount(1, discardServerHandler);
socket.getOutputStream().write(('@' + "Test").getBytes());
socket.getOutputStream().flush();
try {
assertMessageReceivedCount(2, discardServerHandler);
Assert.fail();
} catch (ConditionTimeoutException e) {
// ignore
}
} finally {
IOUtils.closeQuietly(socket);
PinpointRPCTestUtils.close(serverAcceptor);
}
}
Aggregations