HTTPClientBuilder { Duration callTimeout() { int attempts = maxRetries == null ? 1 : maxRetries; long timeout = connectTimeout.toMillis() + this.timeout.toMillis() * attempts; for (int i = 1; i < attempts; i++) { timeout += 600 << i - 1; } timeout += 2000; return Duration.ofMillis(timeout); } HTTPClientBuilder(); HTTPClient build(); HTTPClientBuilder connectTimeout(Duration connectTimeout); HTTPClientBuilder timeout(Duration timeout); HTTPClientBuilder keepAlive(Duration keepAlive); HTTPClientBuilder slowOperationThreshold(Duration slowOperationThreshold); HTTPClientBuilder userAgent(String userAgent); HTTPClientBuilder maxRetries(int maxRetries); HTTPClientBuilder retryWaitTime(Duration waitTime); HTTPClientBuilder enableCookie(); HTTPClientBuilder trustAll(); HTTPClientBuilder trust(String cert);  }
@Test void callTimeout() { builder.connectTimeout(Duration.ofSeconds(1)); builder.timeout(Duration.ofSeconds(2)); assertThat(builder.callTimeout()).isEqualTo(Duration.ofMillis(1000 + 2000 + 2000)); builder.maxRetries(1); assertThat(builder.callTimeout()).isEqualTo(Duration.ofMillis(1000 + 2000 + 2000)); builder.maxRetries(2); assertThat(builder.callTimeout()).isEqualTo(Duration.ofMillis(1000 + 2000 * 2 + 600 + 2000)); builder.maxRetries(3); assertThat(builder.callTimeout()).isEqualTo(Duration.ofMillis(1000 + 2000 * 3 + 600 + 1200 + 2000)); }