Search in sources :

Example 1 with ClientProxyOptions

use of reactor.ipc.netty.options.ClientProxyOptions in project spring-cloud-gateway by spring-cloud.

the class GatewayAutoConfigurationTests method nettyHttpClientDefaults.

@Test
public void nettyHttpClientDefaults() {
    new ReactiveWebApplicationContextRunner().withConfiguration(AutoConfigurations.of(WebFluxAutoConfiguration.class, GatewayAutoConfiguration.class)).withPropertyValues("debug=true").run(context -> {
        assertThat(context).hasSingleBean(HttpClient.class);
        HttpClient httpClient = context.getBean(HttpClient.class);
        HttpClientOptions options = httpClient.options();
        PoolResources poolResources = options.getPoolResources();
        assertThat(poolResources).isNotNull();
        // TODO: howto test PoolResources
        ClientProxyOptions proxyOptions = options.getProxyOptions();
        assertThat(proxyOptions).isNull();
        SslContext sslContext = options.sslContext();
        assertThat(sslContext).isNull();
    });
}
Also used : WebFluxAutoConfiguration(org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration) PoolResources(reactor.ipc.netty.resources.PoolResources) ClientProxyOptions(reactor.ipc.netty.options.ClientProxyOptions) HttpClient(reactor.ipc.netty.http.client.HttpClient) HttpClientOptions(reactor.ipc.netty.http.client.HttpClientOptions) ReactiveWebApplicationContextRunner(org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner) SslContext(io.netty.handler.ssl.SslContext) Test(org.junit.Test)

Example 2 with ClientProxyOptions

use of reactor.ipc.netty.options.ClientProxyOptions in project spring-cloud-gateway by spring-cloud.

the class GatewayAutoConfigurationTests method nettyHttpClientConfigured.

@Test
public void nettyHttpClientConfigured() {
    new ReactiveWebApplicationContextRunner().withConfiguration(AutoConfigurations.of(WebFluxAutoConfiguration.class, GatewayAutoConfiguration.class)).withPropertyValues("spring.cloud.gateway.httpclient.ssl.use-insecure-trust-manager=true", "spring.cloud.gateway.httpclient.pool.type=fixed", "spring.cloud.gateway.httpclient.proxy.host=myhost").run(context -> {
        assertThat(context).hasSingleBean(HttpClient.class);
        HttpClient httpClient = context.getBean(HttpClient.class);
        HttpClientOptions options = httpClient.options();
        PoolResources poolResources = options.getPoolResources();
        assertThat(poolResources).isNotNull();
        // TODO: howto test PoolResources
        ClientProxyOptions proxyOptions = options.getProxyOptions();
        assertThat(proxyOptions).isNotNull();
        assertThat(proxyOptions.getAddress().get().getHostName()).isEqualTo("myhost");
        SslContext sslContext = options.sslContext();
        assertThat(sslContext).isNotNull();
    // TODO: howto test SslContext
    });
}
Also used : WebFluxAutoConfiguration(org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration) PoolResources(reactor.ipc.netty.resources.PoolResources) ClientProxyOptions(reactor.ipc.netty.options.ClientProxyOptions) HttpClient(reactor.ipc.netty.http.client.HttpClient) HttpClientOptions(reactor.ipc.netty.http.client.HttpClientOptions) ReactiveWebApplicationContextRunner(org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner) SslContext(io.netty.handler.ssl.SslContext) Test(org.junit.Test)

Aggregations

SslContext (io.netty.handler.ssl.SslContext)2 Test (org.junit.Test)2 WebFluxAutoConfiguration (org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration)2 ReactiveWebApplicationContextRunner (org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner)2 HttpClient (reactor.ipc.netty.http.client.HttpClient)2 HttpClientOptions (reactor.ipc.netty.http.client.HttpClientOptions)2 ClientProxyOptions (reactor.ipc.netty.options.ClientProxyOptions)2 PoolResources (reactor.ipc.netty.resources.PoolResources)2