### Question:
PeerReputation { public Optional<DisconnectReason> recordRequestTimeout(final int requestCode) { final int newTimeoutCount = getOrCreateTimeoutCount(requestCode).incrementAndGet(); if (newTimeoutCount >= TIMEOUT_THRESHOLD) { LOG.debug("Disconnection triggered by repeated timeouts"); return Optional.of(DisconnectReason.TIMEOUT); } else { return Optional.empty(); } }  Optional<DisconnectReason> recordRequestTimeout(final int requestCode); void resetTimeoutCount(final int requestCode); Map<Integer, AtomicInteger> timeoutCounts(); Optional<DisconnectReason> recordUselessResponse(final long timestamp);  }### Answer:
@Test public void shouldOnlyDisconnectWhenTimeoutLimitReached() { assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_HEADERS)).isEmpty(); assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_HEADERS)).isEmpty(); assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_HEADERS)).contains(TIMEOUT); }
@Test public void shouldTrackTimeoutsSeparatelyForDifferentRequestTypes() { assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_HEADERS)).isEmpty(); assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_HEADERS)).isEmpty(); assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_BODIES)).isEmpty(); assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_BODIES)).isEmpty(); assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_HEADERS)).contains(TIMEOUT); assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_BODIES)).contains(TIMEOUT); }