@Test
public void preemptiveAuth() {

    String hostName = "targetHost";
    int port = 80;
    HttpHost targetHost = new HttpHost(hostName, port, "http");
    HttpClientConfig httpClientConfig = new HttpClientConfig.Builder("localhost")
            .defaultCredentials("someUser", "somePassword")
            .setPreemptiveAuth(targetHost)
            .build();
    assertThat(httpClientConfig.getPreemptiveAuthTargetHosts(), hasItem(targetHost));
}