use of org.ethereum.net.p2p.HelloMessage in project rskj by rsksmart.
the class HelloMessageTest method test3.
// Fail test
@Test
public void test3() {
// Init
// invalid version
byte version = -1;
// null id
String clientStr = "";
List<Capability> capabilities = Arrays.asList(new Capability(null, (byte) 0), new Capability(null, (byte) 0), // null here causes NullPointerException when using toString
null, // encoding null capabilities
new Capability(null, (byte) 0));
// invalid port
int listenPort = 99999;
// null id
String peerId = "";
HelloMessage helloMessage = new HelloMessage(version, clientStr, capabilities, listenPort, peerId);
assertEquals(P2pMessageCodes.HELLO, helloMessage.getCommand());
assertEquals(version, helloMessage.getP2PVersion());
assertEquals(clientStr, helloMessage.getClientId());
assertEquals(4, helloMessage.getCapabilities().size());
assertEquals(listenPort, helloMessage.getListenPort());
assertEquals(peerId, helloMessage.getPeerId());
}
Aggregations