use of co.rsk.net.discovery.message.PongPeerMessage in project rskj by rsksmart.
the class PeerDiscoveryRequestTest method create.
@Test
public void create() {
ECKey key = new ECKey();
String check = UUID.randomUUID().toString();
PingPeerMessage pingPeerMessage = PingPeerMessage.create("localhost", 80, check, key);
PongPeerMessage pongPeerMessage = PongPeerMessage.create("localhost", 80, check, key);
InetSocketAddress address = new InetSocketAddress("localhost", 8080);
PeerDiscoveryRequest request = PeerDiscoveryRequestBuilder.builder().messageId(check).message(pingPeerMessage).address(address).expectedResponse(DiscoveryMessageType.PONG).expirationPeriod(1000).attemptNumber(1).build();
Assert.assertNotNull(request);
Assert.assertTrue(request.validateMessageResponse(pongPeerMessage));
Assert.assertFalse(request.validateMessageResponse(pingPeerMessage));
}
Aggregations