### Question:
PeerManager implements ConnectionHandler { public SafeFuture<Peer> connect(final MultiaddrPeerAddress peer, final Network network) { return pendingConnections.computeIfAbsent(peer.getId(), __ -> doConnect(peer, network)); } PeerManager(
      final MetricsSystem metricsSystem,
      final ReputationManager reputationManager,
      final List<PeerHandler> peerHandlers,
      final Map<RpcMethod, RpcHandler> rpcHandlers); @Override void handleConnection(@NotNull final Connection connection); long subscribeConnect(final PeerConnectedSubscriber<Peer> subscriber); void unsubscribeConnect(final long subscriptionId); SafeFuture<Peer> connect(final MultiaddrPeerAddress peer, final Network network); Optional<Peer> getPeer(NodeId id); Stream<Peer> streamPeers(); int getPeerCount();  }### Answer:
@Test public void shouldReportFailedConnectionsToReputationManager() { final Multiaddr multiaddr = Multiaddr.fromString("/ip4/127.0.0.1/tcp/9000"); final MultiaddrPeerAddress peerAddress = new MultiaddrPeerAddress(new MockNodeId(1), multiaddr); when(network.connect(multiaddr)) .thenReturn(CompletableFuture.failedFuture(new RuntimeException("Nope"))); final SafeFuture<Peer> result = peerManager.connect(peerAddress, network); assertThat(result).isCompletedExceptionally(); verify(reputationManager).reportInitiatedConnectionFailed(peerAddress); verify(reputationManager, never()).reportInitiatedConnectionSuccessful(peerAddress); }