use of org.ethereum.net.rlpx.Node in project rskj by rsksmart.
the class NodeManagerTest method getNodesPeerDiscoveryEnable.
@Test
public void getNodesPeerDiscoveryEnable() {
List<Node> activePeers = new ArrayList<>();
activePeers.add(new Node(Hex.decode(NODE_ID_2), "127.0.0.2", 8081));
List<Node> bootNodes = new ArrayList<>();
bootNodes.add(new Node(Hex.decode(NODE_ID_3), "127.0.0.3", 8083));
Mockito.when(config.peerActive()).thenReturn(activePeers);
Mockito.when(peerExplorer.getNodes()).thenReturn(bootNodes);
Mockito.when(config.isPeerDiscoveryEnabled()).thenReturn(true);
nodeManager.init();
Set<String> nodesInUse = new HashSet<>();
List<NodeHandler> availableNodes = nodeManager.getNodes(nodesInUse);
Assert.assertEquals(2, availableNodes.size());
}
Aggregations