use of org.aion.zero.impl.sync.TrieNodeWrapper in project aion by aionnetwork.
the class ResponseTrieDataHandlerTest method testReceive_incorrectMessage.
@Test
public void testReceive_incorrectMessage() {
Logger log = mock(Logger.class);
when(log.isTraceEnabled()).thenReturn(false);
BlockingQueue<TrieNodeWrapper> receivedQueue = mock(LinkedBlockingQueue.class);
ResponseTrieDataHandler handler = new ResponseTrieDataHandler(log, receivedQueue);
// receive incorrect message
byte[] outOfOderEncoding = RLP.encodeList(RLP.encodeList(RLP.encodeList(RLP.encodeElement(nodeKey), RLP.encodeElement(leafValue)), RLP.encodeList(RLP.encodeElement(altNodeKey), RLP.encodeElement(leafValue))), RLP.encodeElement(nodeKey), RLP.encodeElement(leafValue), RLP.encodeString(STATE.toString()));
handler.receive(peerId, displayId, outOfOderEncoding);
verify(log, times(1)).error("<res-trie decode-error msg-bytes={} peer={}>", outOfOderEncoding.length, displayId);
verifyZeroInteractions(receivedQueue);
}
Aggregations