Search in sources :

Example 1 with CONNECT_TIMEOUT_MILLIS

use of io.netty.channel.ChannelOption.CONNECT_TIMEOUT_MILLIS 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));
    });
}
Also used : SO_SNDBUF(io.netty.channel.ChannelOption.SO_SNDBUF) LoggerFactory(org.slf4j.LoggerFactory) SO_RCVBUF(io.netty.channel.ChannelOption.SO_RCVBUF) DeserializationFeature(com.fasterxml.jackson.databind.DeserializationFeature) CONNECT_TIMEOUT_MILLIS(io.netty.channel.ChannelOption.CONNECT_TIMEOUT_MILLIS) PreDestroy(javax.annotation.PreDestroy) FAIL_ON_UNKNOWN_PROPERTIES(com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) DeserializationProblemHandler(com.fasterxml.jackson.databind.deser.DeserializationProblemHandler) Value(org.immutables.value.Value) SslCertificateTruster(org.cloudfoundry.reactor.util.SslCertificateTruster) Duration(java.time.Duration) HttpClient(reactor.ipc.netty.http.client.HttpClient) LoopResources(reactor.ipc.netty.resources.LoopResources) ManagementFactory(java.lang.management.ManagementFactory) NON_NULL(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL) ByteBufAllocatorMetricProviderWrapper(org.cloudfoundry.reactor.util.ByteBufAllocatorMetricProviderWrapper) Logger(org.slf4j.Logger) SO_KEEPALIVE(io.netty.channel.ChannelOption.SO_KEEPALIVE) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DefaultSslCertificateTruster(org.cloudfoundry.reactor.util.DefaultSslCertificateTruster) Mono(reactor.core.publisher.Mono) ObjectName(javax.management.ObjectName) PooledByteBufAllocator(io.netty.buffer.PooledByteBufAllocator) Nullable(org.cloudfoundry.Nullable) PoolResources(reactor.ipc.netty.resources.PoolResources) Jdk8Module(com.fasterxml.jackson.datatype.jdk8.Jdk8Module) StaticTrustManagerFactory(org.cloudfoundry.reactor.util.StaticTrustManagerFactory) MalformedObjectNameException(javax.management.MalformedObjectNameException) List(java.util.List) JMException(javax.management.JMException) PostConstruct(javax.annotation.PostConstruct) Optional(java.util.Optional) StaticTrustManagerFactory(org.cloudfoundry.reactor.util.StaticTrustManagerFactory)

Aggregations

NON_NULL (com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)1 DeserializationFeature (com.fasterxml.jackson.databind.DeserializationFeature)1 FAIL_ON_UNKNOWN_PROPERTIES (com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 DeserializationProblemHandler (com.fasterxml.jackson.databind.deser.DeserializationProblemHandler)1 Jdk8Module (com.fasterxml.jackson.datatype.jdk8.Jdk8Module)1 PooledByteBufAllocator (io.netty.buffer.PooledByteBufAllocator)1 CONNECT_TIMEOUT_MILLIS (io.netty.channel.ChannelOption.CONNECT_TIMEOUT_MILLIS)1 SO_KEEPALIVE (io.netty.channel.ChannelOption.SO_KEEPALIVE)1 SO_RCVBUF (io.netty.channel.ChannelOption.SO_RCVBUF)1 SO_SNDBUF (io.netty.channel.ChannelOption.SO_SNDBUF)1 ManagementFactory (java.lang.management.ManagementFactory)1 Duration (java.time.Duration)1 List (java.util.List)1 Optional (java.util.Optional)1 PostConstruct (javax.annotation.PostConstruct)1 PreDestroy (javax.annotation.PreDestroy)1 JMException (javax.management.JMException)1 MalformedObjectNameException (javax.management.MalformedObjectNameException)1 ObjectName (javax.management.ObjectName)1