/**
* Verifier of JERSEY-2424 fix.
*/
@Test
public void testHttpClientInstanceAccess() {
final Client client = ClientBuilder.newClient(new ClientConfig().connectorProvider(new ApacheConnectorProvider()));
final HttpClient hcOnClient = ApacheConnectorProvider.getHttpClient(client);
// important: the web target instance in this test must be only created AFTER the client has been pre-initialized
// (see org.glassfish.jersey.client.Initializable.preInitialize method). This is here achieved by calling the
// connector provider's static getHttpClient method above.
final WebTarget target = client.target("http://localhost/");
final HttpClient hcOnTarget = ApacheConnectorProvider.getHttpClient(target);
assertNotNull("HTTP client instance set on JerseyClient should not be null.", hcOnClient);
assertNotNull("HTTP client instance set on JerseyWebTarget should not be null.", hcOnTarget);
assertSame("HTTP client instance set on JerseyClient should be the same instance as the one set on JerseyWebTarget" +