use of org.ethereum.net.message.Message in project rskj by rsksmart.
the class MessageFilterTest method rejectRskMessageIfMessageTypeDoesNotMatch.
@Test
public void rejectRskMessageIfMessageTypeDoesNotMatch() {
List<String> commands = new ArrayList<>();
commands.add("RSK_MESSAGE:GET_BLOCKS_MESSAGE");
commands.add("TRANSACTIONS");
commands.add("BLOCKS");
MessageFilter filter = new MessageFilter(commands);
Message rskMessage = WriterMessageRecorderTest.createRskMessage();
Message ethMessage = WriterMessageRecorderTest.createEthMessage();
Assert.assertFalse(filter.acceptMessage(rskMessage));
Assert.assertTrue(filter.acceptMessage(ethMessage));
}
use of org.ethereum.net.message.Message in project rskj by rsksmart.
the class MessageFilterTest method filterAcceptRskMessageWhenCommandIsSpecified.
@Test
public void filterAcceptRskMessageWhenCommandIsSpecified() {
List<String> commands = new ArrayList<>();
commands.add("RSK_MESSAGE");
MessageFilter filter = new MessageFilter(commands);
Message rskMessage = WriterMessageRecorderTest.createRskMessage();
Message ethMessage = WriterMessageRecorderTest.createEthMessage();
Assert.assertTrue(filter.acceptMessage(rskMessage));
Assert.assertFalse(filter.acceptMessage(ethMessage));
}
use of org.ethereum.net.message.Message in project rskj by rsksmart.
the class MessageFilterTest method filterMessagesWhenRskMessageTypeIsSpecified.
@Test
public void filterMessagesWhenRskMessageTypeIsSpecified() {
List<String> commands = new ArrayList<>();
commands.add("RSK_MESSAGE:GET_BLOCK_MESSAGE");
commands.add("TRANSACTIONS");
commands.add("BLOCKS");
MessageFilter filter = new MessageFilter(commands);
Message rskMessage = WriterMessageRecorderTest.createRskMessage();
Message ethMessage = WriterMessageRecorderTest.createEthMessage();
Assert.assertTrue(filter.acceptMessage(rskMessage));
Assert.assertTrue(filter.acceptMessage(ethMessage));
}
use of org.ethereum.net.message.Message in project rskj by rsksmart.
the class MessageFilterTest method filterWithEmptyCommandsAcceptsAnyMessage.
@Test
public void filterWithEmptyCommandsAcceptsAnyMessage() {
List<String> commands = new ArrayList<>();
MessageFilter filter = new MessageFilter(commands);
Message rskMessage = WriterMessageRecorderTest.createRskMessage();
Message ethMessage = WriterMessageRecorderTest.createEthMessage();
Assert.assertTrue(filter.acceptMessage(rskMessage));
Assert.assertTrue(filter.acceptMessage(ethMessage));
}
use of org.ethereum.net.message.Message in project rskj by rsksmart.
the class MessageFilterTest method filterAcceptsEthMessageWhenCommandIsSpecified.
@Test
public void filterAcceptsEthMessageWhenCommandIsSpecified() {
List<String> commands = new ArrayList<>();
commands.add("TRANSACTIONS");
MessageFilter filter = new MessageFilter(commands);
Message rskMessage = WriterMessageRecorderTest.createRskMessage();
Message ethMessage = WriterMessageRecorderTest.createEthMessage();
Assert.assertFalse(filter.acceptMessage(rskMessage));
Assert.assertTrue(filter.acceptMessage(ethMessage));
}
Aggregations