use of org.cloudfoundry.reactor.util.StaticTrustManagerFactory in project cf-java-client by cloudfoundry.
the class _DefaultConnectionContext method getHttpClient.
@Override
@Value.Default
public HttpClient getHttpClient() {
return HttpClient.create(options -> {
options.compression(true).loopResources(getThreadPool()).option(SO_SNDBUF, SEND_BUFFER_SIZE).option(SO_RCVBUF, RECEIVE_BUFFER_SIZE).disablePool();
options.sslSupport(ssl -> getSslCertificateTruster().ifPresent(trustManager -> ssl.trustManager(new StaticTrustManagerFactory(trustManager))));
getConnectionPool().ifPresent(options::poolResources);
getConnectTimeout().ifPresent(socketTimeout -> options.option(CONNECT_TIMEOUT_MILLIS, (int) socketTimeout.toMillis()));
getKeepAlive().ifPresent(keepAlive -> options.option(SO_KEEPALIVE, keepAlive));
getSslHandshakeTimeout().ifPresent(options::sslHandshakeTimeout);
getSslCloseNotifyFlushTimeout().ifPresent(options::sslCloseNotifyFlushTimeout);
getSslCloseNotifyReadTimeout().ifPresent(options::sslCloseNotifyReadTimeout);
getProxyConfiguration().ifPresent(c -> c.configure(options));
});
}
Aggregations