ClusterControllerClientTimeouts implements JaxRsTimeouts { public Duration getServerTimeoutOrThrow() { Duration serverTimeout = getReadTimeoutOrThrow().minus(DOWNSTREAM_OVERHEAD); if (serverTimeout.toMillis() < MIN_SERVER_TIMEOUT.toMillis()) { throw new UncheckedTimeoutException("Timed out after " + timeBudget.originalTimeout().get()); } return serverTimeout; } ClusterControllerClientTimeouts(TimeBudget timeBudget); @Override Duration getConnectTimeoutOrThrow(); @Override Duration getReadTimeoutOrThrow(); Duration getServerTimeoutOrThrow();  }
@Test public void alreadyTimedOut() { clock.advance(Duration.ofSeconds(4)); try { timeouts.getServerTimeoutOrThrow(); fail(); } catch (UncheckedTimeoutException e) { assertEquals("Timed out after PT3S", e.getMessage()); } }
@Test public void justTooLittleTime() { clock.advance(originalTimeout.minus(MINIMUM_TIME_LEFT).plus(Duration.ofMillis(1))); try { timeouts.getServerTimeoutOrThrow(); fail(); } catch (UncheckedTimeoutException e) { assertEquals("Timed out after PT3S", e.getMessage()); } }
@Test public void justEnoughTime() { clock.advance(originalTimeout.minus(MINIMUM_TIME_LEFT)); timeouts.getServerTimeoutOrThrow(); }