use of reactor.netty.http.Http2SslContextSpec in project reactor-netty by reactor.
the class HttpServerTests method testIssue1286ErrorResponse_ServerHTTP11AndH2ClientHTTP11AndH2.
@Test
void testIssue1286ErrorResponse_ServerHTTP11AndH2ClientHTTP11AndH2() throws Exception {
Http2SslContextSpec serverCtx = Http2SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
Http2SslContextSpec clientCtx = Http2SslContextSpec.forClient().configure(builder -> builder.trustManager(InsecureTrustManagerFactory.INSTANCE));
doTestIssue1286(server -> server.protocol(HttpProtocol.H2, HttpProtocol.HTTP11).secure(spec -> spec.sslContext(serverCtx)), client -> client.protocol(HttpProtocol.H2, HttpProtocol.HTTP11).secure(spec -> spec.sslContext(clientCtx)), false, true);
}
use of reactor.netty.http.Http2SslContextSpec in project reactor-netty by reactor.
the class HttpServerTests method testHttpServerWithDomainSockets_HTTP2.
@Test
void testHttpServerWithDomainSockets_HTTP2() {
Http2SslContextSpec serverCtx = Http2SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
Http2SslContextSpec clientCtx = Http2SslContextSpec.forClient().configure(builder -> builder.trustManager(InsecureTrustManagerFactory.INSTANCE));
doTestHttpServerWithDomainSockets(HttpServer.create().protocol(HttpProtocol.H2).secure(spec -> spec.sslContext(serverCtx)), HttpClient.create().protocol(HttpProtocol.H2).secure(spec -> spec.sslContext(clientCtx)), "https");
}
use of reactor.netty.http.Http2SslContextSpec in project reactor-netty by reactor.
the class HttpServerTests method testIssue1286ConnectionCloseErrorResponse_ServerHTTP11AndH2ClientH2.
@Test
void testIssue1286ConnectionCloseErrorResponse_ServerHTTP11AndH2ClientH2() throws Exception {
Http2SslContextSpec serverCtx = Http2SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
Http2SslContextSpec clientCtx = Http2SslContextSpec.forClient().configure(builder -> builder.trustManager(InsecureTrustManagerFactory.INSTANCE));
doTestIssue1286(server -> server.protocol(HttpProtocol.H2, HttpProtocol.HTTP11).secure(spec -> spec.sslContext(serverCtx)), client -> client.protocol(HttpProtocol.H2).secure(spec -> spec.sslContext(clientCtx)), true, true);
}
use of reactor.netty.http.Http2SslContextSpec in project reactor-netty by reactor.
the class HttpServerTests method testIssue1286_H2.
@Test
void testIssue1286_H2() throws Exception {
Http2SslContextSpec serverCtx = Http2SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
Http2SslContextSpec clientCtx = Http2SslContextSpec.forClient().configure(builder -> builder.trustManager(InsecureTrustManagerFactory.INSTANCE));
doTestIssue1286(server -> server.protocol(HttpProtocol.H2).secure(spec -> spec.sslContext(serverCtx)), client -> client.protocol(HttpProtocol.H2).secure(spec -> spec.sslContext(clientCtx)), false, false);
}
use of reactor.netty.http.Http2SslContextSpec in project reactor-netty by reactor.
the class HttpClientTest method testConnectionLifeTimeFixedPoolHttp2_2.
@Test
void testConnectionLifeTimeFixedPoolHttp2_2() {
Http2SslContextSpec serverCtx = Http2SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
Http2SslContextSpec clientCtx = Http2SslContextSpec.forClient().configure(builder -> builder.trustManager(InsecureTrustManagerFactory.INSTANCE));
disposableServer = createServer().protocol(HttpProtocol.H2).secure(spec -> spec.sslContext(serverCtx)).http2Settings(setting -> setting.maxConcurrentStreams(2)).handle((req, resp) -> resp.sendObject(ByteBufFlux.fromString(Mono.delay(Duration.ofMillis(30)).map(Objects::toString)))).bindNow();
ConnectionProvider provider = ConnectionProvider.builder("testConnectionLifeTimeFixedPoolHttp2_2").maxConnections(1).maxLifeTime(Duration.ofMillis(30)).build();
HttpClient client = createClient(provider, () -> disposableServer.address()).protocol(HttpProtocol.H2).secure(spec -> spec.sslContext(clientCtx));
Flux<ChannelId> id = client.get().uri("/").responseConnection((res, conn) -> Mono.just(conn.channel().parent().id()).delayUntil(ch -> conn.inbound().receive()));
try {
// warmup
id.blockLast(Duration.ofSeconds(5));
List<ChannelId> ids = Flux.range(0, 3).flatMap(i -> id).collectList().block(Duration.ofSeconds(5));
assertThat(ids).isNotNull().hasSize(3);
assertThat(ids.get(0)).isEqualTo(ids.get(1));
assertThat(ids.get(0)).isNotEqualTo(ids.get(2));
} finally {
provider.disposeLater().block(Duration.ofSeconds(5));
}
}
Aggregations