use of org.ethereum.net.p2p.DisconnectMessage in project rskj by rsksmart.
the class DisconnectMessageTest method test_1.
/* DISCONNECT_MESSAGE */
@Test
public /* DisconnectMessage 1 - Requested */
void test_1() {
byte[] payload = Hex.decode("C100");
DisconnectMessage disconnectMessage = new DisconnectMessage(payload);
logger.trace("{}" + disconnectMessage);
assertEquals(disconnectMessage.getReason(), ReasonCode.REQUESTED);
}
use of org.ethereum.net.p2p.DisconnectMessage in project rskj by rsksmart.
the class DisconnectMessageTest method test_6.
// handling boundary-low minus 1 (error)
@Test
public void test_6() {
String disconnectMessageRaw = "C19999";
byte[] payload = Hex.decode(disconnectMessageRaw);
try {
DisconnectMessage disconnectMessage = new DisconnectMessage(payload);
// throws exception
disconnectMessage.toString();
assertTrue("Valid raw encoding for disconnectMessage", false);
} catch (RuntimeException e) {
assertTrue("Invalid raw encoding for disconnectMessage", true);
}
}
Aggregations