use of com.navercorp.pinpoint.thrift.io.NetworkAvailabilityCheckPacket in project pinpoint by naver.
the class NetworkAvailabilityCheckPacketFilterTest method testFilter.
@Test
public void testFilter() throws Exception {
SocketAddress localSocketAddress = senderSocket.getLocalSocketAddress();
logger.debug("localSocket:{}", localSocketAddress);
NetworkAvailabilityCheckPacket packet = new NetworkAvailabilityCheckPacket();
boolean skipResult = filter.filter(receiverSocket, packet, new InetSocketAddress("localhost", senderSocket.getLocalPort()));
Assert.assertEquals(skipResult, TBaseFilter.BREAK);
DatagramPacket receivePacket = new DatagramPacket(new byte[100], 100);
senderSocket.receive(receivePacket);
Assert.assertEquals(receivePacket.getLength(), NetworkAvailabilityCheckPacket.DATA_OK.length);
Assert.assertArrayEquals(Arrays.copyOf(receivePacket.getData(), NetworkAvailabilityCheckPacket.DATA_OK.length), NetworkAvailabilityCheckPacket.DATA_OK);
}
use of com.navercorp.pinpoint.thrift.io.NetworkAvailabilityCheckPacket in project pinpoint by naver.
the class NetworkAvailabilityChecker method getNetworkCheckPayload.
private static byte[] getNetworkCheckPayload() throws TException {
HeaderTBaseSerializer serializer = new HeaderTBaseSerializerFactory(false, 65535, false).createSerializer();
byte[] payload = serializer.serialize(new NetworkAvailabilityCheckPacket());
int size = serializer.getInterBufferSize();
return Arrays.copyOf(payload, size);
}
Aggregations