org.springframework.web.reactive.socket.server.upgrade.ReactorNettyRequestUpgradeStrategy Java Examples
The following examples show how to use
org.springframework.web.reactive.socket.server.upgrade.ReactorNettyRequestUpgradeStrategy.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GatewayAutoConfiguration.java From spring-cloud-gateway with Apache License 2.0 | 5 votes |
@Bean public ReactorNettyRequestUpgradeStrategy reactorNettyRequestUpgradeStrategy( HttpClientProperties httpClientProperties) { ReactorNettyRequestUpgradeStrategy requestUpgradeStrategy = new ReactorNettyRequestUpgradeStrategy(); HttpClientProperties.Websocket websocket = httpClientProperties .getWebsocket(); PropertyMapper map = PropertyMapper.get(); map.from(websocket::getMaxFramePayloadLength).whenNonNull() .to(requestUpgradeStrategy::setMaxFramePayloadLength); map.from(websocket::isProxyPing).to(requestUpgradeStrategy::setHandlePing); return requestUpgradeStrategy; }
Example #2
Source File: AbstractWebSocketIntegrationTests.java From spring-analysis-note with MIT License | 4 votes |
@Override protected RequestUpgradeStrategy getUpgradeStrategy() { return new ReactorNettyRequestUpgradeStrategy(); }
Example #3
Source File: AbstractWebSocketIntegrationTests.java From java-technology-stack with MIT License | 4 votes |
@Override protected RequestUpgradeStrategy getUpgradeStrategy() { return new ReactorNettyRequestUpgradeStrategy(); }
Example #4
Source File: WebSocketRouter.java From webFluxTemplate with MIT License | 4 votes |
@Bean public WebSocketService webSocketService() { return new HandshakeWebSocketService(new ReactorNettyRequestUpgradeStrategy()); }
Example #5
Source File: ReactiveChatSocketConfig.java From Spring-5.0-Cookbook with MIT License | 4 votes |
@Bean public WebSocketService webSocketService() { return new HandshakeWebSocketService(new ReactorNettyRequestUpgradeStrategy()); }
Example #6
Source File: GatewayAutoConfigurationTests.java From spring-cloud-gateway with Apache License 2.0 | 4 votes |
@Test public void nettyHttpClientConfigured() { new ReactiveWebApplicationContextRunner() .withConfiguration(AutoConfigurations.of(WebFluxAutoConfiguration.class, MetricsAutoConfiguration.class, SimpleMetricsExportAutoConfiguration.class, GatewayAutoConfiguration.class, HttpClientCustomizedConfig.class)) .withPropertyValues( "spring.cloud.gateway.httpclient.ssl.use-insecure-trust-manager=true", "spring.cloud.gateway.httpclient.connect-timeout=10", "spring.cloud.gateway.httpclient.response-timeout=10s", "spring.cloud.gateway.httpclient.pool.type=fixed", // greather than integer max value "spring.cloud.gateway.httpclient.max-initial-line-length=2147483647", "spring.cloud.gateway.httpclient.proxy.host=myhost", "spring.cloud.gateway.httpclient.websocket.max-frame-payload-length=1024") .run(context -> { assertThat(context).hasSingleBean(HttpClient.class); HttpClient httpClient = context.getBean(HttpClient.class); HttpClientProperties properties = context .getBean(HttpClientProperties.class); assertThat(properties.getMaxInitialLineLength().toBytes()) .isLessThanOrEqualTo(Integer.MAX_VALUE); /* * FIXME: 2.1.0 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 assertThat(context) .hasSingleBean(ReactorNettyRequestUpgradeStrategy.class); ReactorNettyRequestUpgradeStrategy upgradeStrategy = context .getBean(ReactorNettyRequestUpgradeStrategy.class); assertThat(upgradeStrategy.getMaxFramePayloadLength()) .isEqualTo(1024); assertThat(upgradeStrategy.getHandlePing()).isTrue(); assertThat(context).hasSingleBean(ReactorNettyWebSocketClient.class); ReactorNettyWebSocketClient webSocketClient = context .getBean(ReactorNettyWebSocketClient.class); assertThat(webSocketClient.getMaxFramePayloadLength()) .isEqualTo(1024); HttpClientCustomizedConfig config = context .getBean(HttpClientCustomizedConfig.class); assertThat(config.called.get()).isTrue(); }); }
Example #7
Source File: WebSocketIntegrationTests.java From spring-cloud-gateway with Apache License 2.0 | 4 votes |
protected RequestUpgradeStrategy getUpgradeStrategy() { return new ReactorNettyRequestUpgradeStrategy(); }
Example #8
Source File: Application.java From spring-reactive-playground with Apache License 2.0 | 4 votes |
@Bean public WebSocketService webSocketService() { return new HandshakeWebSocketService(new ReactorNettyRequestUpgradeStrategy()); }