use of org.springframework.boot.web.server.Http2 in project spring-boot by spring-projects.
the class AbstractReactiveWebServerFactoryTests method whenHttp2IsEnabledAndSslIsDisabledThenHttp11CanStillBeUsed.
@Test
protected void whenHttp2IsEnabledAndSslIsDisabledThenHttp11CanStillBeUsed() throws InterruptedException, ExecutionException, IOException {
AbstractReactiveWebServerFactory factory = getFactory();
Http2 http2 = new Http2();
http2.setEnabled(true);
factory.setHttp2(http2);
this.webServer = factory.getWebServer(new EchoHandler());
this.webServer.start();
Mono<String> result = getWebClient(this.webServer.getPort()).build().post().uri("/test").contentType(MediaType.TEXT_PLAIN).body(BodyInserters.fromValue("Hello World")).retrieve().bodyToMono(String.class);
assertThat(result.block(Duration.ofSeconds(30))).isEqualTo("Hello World");
}
use of org.springframework.boot.web.server.Http2 in project spring-boot by spring-projects.
the class SslServerCustomizerTests method whenHttp2IsEnabledServerConnectorsHasSslAlpnH2AndHttpConnectionFactories.
@Test
@SuppressWarnings("rawtypes")
void whenHttp2IsEnabledServerConnectorsHasSslAlpnH2AndHttpConnectionFactories() {
Http2 http2 = new Http2();
http2.setEnabled(true);
Server server = createCustomizedServer(http2);
assertThat(server.getConnectors()).hasSize(1);
List<ConnectionFactory> factories = new ArrayList<>(server.getConnectors()[0].getConnectionFactories());
assertThat(factories).extracting((factory) -> (Class) factory.getClass()).containsExactly(SslConnectionFactory.class, ALPNServerConnectionFactory.class, HTTP2ServerConnectionFactory.class, HttpConnectionFactory.class);
}
Aggregations