-
Notifications
You must be signed in to change notification settings - Fork 18
Java SDK not using ziti socket with Apache HttpClient5 version 5.4 #679
Copy link
Copy link
Closed
Description
Using HttpClient5 version 5.3.1 works correctly. After upgrading to 5.4.2, socket connection refused errors are observed. Below is a sample that uses the ZitiHttpClientConfiguration that is part of the org.openziti:ziti-springboot-client package but created manually instead of via Spring:
// This is using the spring boot ZitiHttpClientConfiguration manually. Normally these would be created as spring beans
ZitiHttpClientConfiguration zitiHttpClientConfiguration = new ZitiHttpClientConfiguration();
ZitiConnectionSocketFactory socketFactory = zitiHttpClientConfiguration.connectionSocketFactory(zitiContext);
ZitiSSLConnectionSocketFactory sslSocketFactory = zitiHttpClientConfiguration.sslConnectionSocketFactory(zitiContext);
PoolingHttpClientConnectionManager poolingMgr = zitiHttpClientConfiguration.poolingConnectionManager(socketFactory, sslSocketFactory,
ZitiHttpClientConfiguration.dnsResolver(), null, null);
CloseableHttpClient client = zitiHttpClientConfiguration.httpClient(poolingMgr, zitiHttpClientConfiguration.connectionKeepAliveStrategy(null), null,
null);
HttpGet httpGet = new HttpGet(new URI(myUriString));
client.execute(httpGet, response -> {
log.info("Reading response");
if (response.getCode() == 200) {
log.info("--- {}", EntityUtils.toString(response.getEntity()));
} else {
log.error("Response code {} received", response.getCode());
}
return response;
});
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels