Search in sources :

Example 1 with SslProvider

use of reactor.netty.tcp.SslProvider in project reactor-netty by reactor.

the class HttpClient method secure.

/**
 * Enable default sslContext support.
 * <p>By default {@link SslContext} is initialized with:
 * <ul>
 *     <li>{@code 10} seconds handshake timeout unless
 *     the environment property {@code reactor.netty.tcp.sslHandshakeTimeout} is set</li>
 *     <li>hostname verification enabled</li>
 * </ul>
 * </p>
 *
 * @return a new {@link HttpClient}
 */
public final HttpClient secure() {
    SslProvider sslProvider = HttpClientSecure.defaultSslProvider(configuration());
    if (sslProvider.equals(configuration().sslProvider)) {
        return this;
    }
    HttpClient dup = duplicate();
    dup.configuration().sslProvider = sslProvider;
    return dup;
}
Also used : SslProvider(reactor.netty.tcp.SslProvider)

Example 2 with SslProvider

use of reactor.netty.tcp.SslProvider in project reactor-netty by reactor.

the class HttpClient method secure.

/**
 * Apply an SSL configuration customization via the passed builder.
 * <p>The builder will produce the {@link SslContext} with:
 * <ul>
 *     <li>{@code 10} seconds handshake timeout unless the passed builder sets another configuration or
 *     the environment property {@code reactor.netty.tcp.sslHandshakeTimeout} is set</li>
 *     <li>hostname verification enabled</li>
 * </ul>
 * </p>
 *
 * @param sslProviderBuilder builder callback for further customization of SslContext.
 * @return a new {@link HttpClient}
 */
public final HttpClient secure(Consumer<? super SslProvider.SslContextSpec> sslProviderBuilder) {
    Objects.requireNonNull(sslProviderBuilder, "sslProviderBuilder");
    SslProvider.SslContextSpec builder = SslProvider.builder();
    sslProviderBuilder.accept(builder);
    SslProvider sslProvider = HttpClientSecure.sslProvider(((SslProvider.Builder) builder).build());
    if (sslProvider.equals(configuration().sslProvider)) {
        return this;
    }
    HttpClient dup = duplicate();
    dup.configuration().sslProvider = sslProvider;
    return dup;
}
Also used : SslProvider(reactor.netty.tcp.SslProvider)

Aggregations

SslProvider (reactor.netty.tcp.SslProvider)2