@Primary
  @Bean("OkHttpClient")
  public OkHttpClient provide(Configuration config, SonarQubeVersion version) {
    OkHttpClientBuilder builder = new OkHttpClientBuilder();
    builder.setConnectTimeoutMs(DEFAULT_CONNECT_TIMEOUT_IN_MS);
    builder.setReadTimeoutMs(DEFAULT_READ_TIMEOUT_IN_MS);
    // no need to define proxy URL as system-wide proxy is used and properly
    // configured by bootstrap process.
    builder.setProxyLogin(config.get(HTTP_PROXY_USER.getKey()).orElse(null));
    builder.setProxyPassword(config.get(HTTP_PROXY_PASSWORD.getKey()).orElse(null));
    builder.setUserAgent(format("SonarQube/%s", version));
    return builder.build();
  }
@Test
  public void get_returns_a_OkHttpClient_with_default_configuration() throws Exception {
    OkHttpClient client = underTest.provide(settings.asConfig(), sonarQubeVersion);

    assertThat(client.connectTimeoutMillis()).isEqualTo(10_000);
    assertThat(client.readTimeoutMillis()).isEqualTo(10_000);
    assertThat(client.proxy()).isNull();

    RecordedRequest recordedRequest = call(client);
    assertThat(recordedRequest.getHeader("User-Agent")).isEqualTo("SonarQube/6.2");
    assertThat(recordedRequest.getHeader("Proxy-Authorization")).isNull();
  }