Browse Source

Stop using deprecated Netty feature in ReactorHttpsServer

pull/26951/head
Sam Brannen 4 years ago
parent
commit
261927b72a
  1. 10
      spring-web/src/testFixtures/java/org/springframework/web/testfixture/http/server/reactive/bootstrap/ReactorHttpsServer.java

10
spring-web/src/testFixtures/java/org/springframework/web/testfixture/http/server/reactive/bootstrap/ReactorHttpsServer.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -19,10 +19,9 @@ package org.springframework.web.testfixture.http.server.reactive.bootstrap; @@ -19,10 +19,9 @@ package org.springframework.web.testfixture.http.server.reactive.bootstrap;
import java.net.InetSocketAddress;
import java.util.concurrent.atomic.AtomicReference;
import io.netty.handler.ssl.SslContextBuilder;
import io.netty.handler.ssl.util.SelfSignedCertificate;
import reactor.netty.DisposableServer;
import reactor.netty.tcp.SslProvider.DefaultConfigurationType;
import reactor.netty.http.Http11SslContextSpec;
import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter;
@ -40,15 +39,14 @@ public class ReactorHttpsServer extends AbstractHttpServer { @@ -40,15 +39,14 @@ public class ReactorHttpsServer extends AbstractHttpServer {
@Override
protected void initServer() throws Exception {
SelfSignedCertificate cert = new SelfSignedCertificate();
SslContextBuilder builder = SslContextBuilder.forServer(cert.certificate(), cert.privateKey());
Http11SslContextSpec http11SslContextSpec = Http11SslContextSpec.forServer(cert.certificate(), cert.privateKey());
this.reactorHandler = createHttpHandlerAdapter();
this.reactorServer = reactor.netty.http.server.HttpServer.create()
.host(getHost())
.port(getPort())
.secure(spec -> spec.sslContext(builder).defaultConfiguration(DefaultConfigurationType.TCP));
.secure(sslContextSpec -> sslContextSpec.sslContext(http11SslContextSpec));
}
private ReactorHttpHandlerAdapter createHttpHandlerAdapter() {

Loading…
Cancel
Save