use of org.ethereum.net.message.Message in project rskj by rsksmart.
the class WriterMessageRecorderTest method recordRskMessageWithSender.
@Test
public void recordRskMessageWithSender() throws IOException {
Message message = createRskMessage();
StringWriter writer = new StringWriter();
BufferedWriter bwriter = new BufferedWriter(writer);
Random random = new Random();
byte[] nodeId = new byte[10];
random.nextBytes(nodeId);
NodeID sender = new NodeID(nodeId);
WriterMessageRecorder recorder = new WriterMessageRecorder(bwriter, null);
recorder.recordMessage(sender, message);
bwriter.close();
String result = writer.toString();
String encoded = Hex.toHexString(message.getEncoded());
Assert.assertTrue(result.contains("," + encoded + "," + Hex.toHexString(nodeId)));
Assert.assertTrue(result.contains(",0,RSK_MESSAGE,GET_BLOCK_MESSAGE,"));
}
Aggregations