### Question:
PeerDiscoveryController { public Stream<DiscoveryPeer> streamDiscoveredPeers() { return peerTable.streamAllPeers().filter(peerPermissions::isAllowedInPeerTable); } private  PeerDiscoveryController(
      final NodeKey nodeKey,
      final DiscoveryPeer localPeer,
      final PeerTable peerTable,
      final Collection<DiscoveryPeer> bootstrapNodes,
      final OutboundMessageHandler outboundMessageHandler,
      final TimerUtil timerUtil,
      final AsyncExecutor workerExecutor,
      final long tableRefreshIntervalMs,
      final long cleanPeerTableIntervalMs,
      final PeerRequirement peerRequirement,
      final PeerPermissions peerPermissions,
      final Subscribers<PeerBondedObserver> peerBondedObservers,
      final MetricsSystem metricsSystem); static Builder builder(); void start(); CompletableFuture<?> stop(); void dropPeer(final PeerId peer); void onMessage(final Packet packet, final DiscoveryPeer sender); Stream<DiscoveryPeer> streamDiscoveredPeers(); void setRetryDelayFunction(final RetryDelayFunction retryDelayFunction); void handleBondingRequest(final DiscoveryPeer peer);  }### Answer:
@Test public void streamDiscoveredPeers() { final List<DiscoveryPeer> peers = createPeersInLastBucket(localPeer, 3); final OutboundMessageHandler outboundMessageHandler = mock(OutboundMessageHandler.class); final PeerPermissions peerPermissions = mock(PeerPermissions.class); doReturn(true).when(peerPermissions).isPermitted(any(), any(), any()); final DiscoveryPeer localNode = DiscoveryPeer.fromEnode( EnodeURL.builder() .ipAddress("127.0.0.1") .nodeId(Peer.randomId()) .discoveryAndListeningPorts(30303) .build()); controller = getControllerBuilder() .localPeer(localNode) .peers(peers) .outboundMessageHandler(outboundMessageHandler) .peerPermissions(peerPermissions) .build(); controller.start(); assertThat(controller.streamDiscoveredPeers().collect(Collectors.toList())) .containsExactlyInAnyOrderElementsOf(peers); final Peer disallowed = peers.get(0); doReturn(false) .when(peerPermissions) .isPermitted(eq(localNode), eq(disallowed), eq(Action.DISCOVERY_ALLOW_IN_PEER_TABLE)); assertThat(controller.streamDiscoveredPeers().collect(Collectors.toList())) .containsExactlyInAnyOrder(peers.get(1), peers.get(2)); }