@Test void receiveFullMessageFromUnknownPeer() { EphemeralPeerRepository repo = new EphemeralPeerRepository(); MockMessageSender messageSender = new MockMessageSender(); State state = new State(repo, Hash::keccak256, messageSender, messageRef::set, (message, peer) -> true); Peer peer = new PeerImpl(); Bytes message = Bytes32.random(); state.receiveGossipMessage(peer, message); assertEquals(1, repo.eagerPushPeers().size()); assertEquals(0, repo.lazyPushPeers().size()); assertEquals(peer, repo.eagerPushPeers().iterator().next()); }
public void receiveGossipMessage(Peer peer, Bytes message) { peerRepository.considerNewPeer(peer); MessageHandler handler = messageHandlers.computeIfAbsent(messageHashingFunction.hash(message), MessageHandler::new); handler.fullMessageReceived(peer, message); }
State { public void receiveGossipMessage(Peer peer, Bytes message) { peerRepository.considerNewPeer(peer); MessageHandler handler = messageHandlers.computeIfAbsent(messageHashingFunction.hash(message), MessageHandler::new); handler.fullMessageReceived(peer, message); } }
State { public void receiveGossipMessage(Peer peer, Bytes message) { peerRepository.considerNewPeer(peer); MessageHandler handler = messageHandlers.computeIfAbsent(messageHashingFunction.hash(message), MessageHandler::new); handler.fullMessageReceived(peer, message); } State(
      PeerRepository peerRepository,
      MessageHashing messageHashingFunction,
      MessageSender messageSender,
      Consumer<Bytes> messageListener,
      MessageValidator messageValidator);  State(
      PeerRepository peerRepository,
      MessageHashing messageHashingFunction,
      MessageSender messageSender,
      Consumer<Bytes> messageListener,
      MessageValidator messageValidator,
      long graftDelay,
      long lazyQueueInterval); }
State { public void receiveGossipMessage(Peer peer, Bytes message) { peerRepository.considerNewPeer(peer); MessageHandler handler = messageHandlers.computeIfAbsent(messageHashingFunction.hash(message), MessageHandler::new); handler.fullMessageReceived(peer, message); } State(
      PeerRepository peerRepository,
      MessageHashing messageHashingFunction,
      MessageSender messageSender,
      Consumer<Bytes> messageListener,
      MessageValidator messageValidator);  State(
      PeerRepository peerRepository,
      MessageHashing messageHashingFunction,
      MessageSender messageSender,
      Consumer<Bytes> messageListener,
      MessageValidator messageValidator,
      long graftDelay,
      long lazyQueueInterval); void addPeer(Peer peer); void removePeer(Peer peer); void receiveGossipMessage(Peer peer, Bytes message); void receiveIHaveMessage(Peer peer, Bytes messageHash); void receivePruneMessage(Peer peer); void receiveGraftMessage(Peer peer, Bytes messageHash); void sendGossipMessage(Bytes message); void stop(); }
State { public void receiveGossipMessage(Peer peer, Bytes message) { peerRepository.considerNewPeer(peer); MessageHandler handler = messageHandlers.computeIfAbsent(messageHashingFunction.hash(message), MessageHandler::new); handler.fullMessageReceived(peer, message); } State(
      PeerRepository peerRepository,
      MessageHashing messageHashingFunction,
      MessageSender messageSender,
      Consumer<Bytes> messageListener,
      MessageValidator messageValidator);  State(
      PeerRepository peerRepository,
      MessageHashing messageHashingFunction,
      MessageSender messageSender,
      Consumer<Bytes> messageListener,
      MessageValidator messageValidator,
      long graftDelay,
      long lazyQueueInterval); void addPeer(Peer peer); void removePeer(Peer peer); void receiveGossipMessage(Peer peer, Bytes message); void receiveIHaveMessage(Peer peer, Bytes messageHash); void receivePruneMessage(Peer peer); void receiveGraftMessage(Peer peer, Bytes messageHash); void sendGossipMessage(Bytes message); void stop();  }