From 00afb19d7a37de21b35ce4f6cb3fa7f74809f2ab Mon Sep 17 00:00:00 2001 From: Alexey Kachayev Date: Mon, 25 Jun 2018 18:10:16 +0300 Subject: [PATCH] Get rid of deprecated SslContext methods in handler-proxy tests Motivation: ProxyHandlerTest package uses deprecated methods SslContext.newServerContext and SslContext.newClientContext. Modifications: SslContextBuilder is used to build server and client SslContext. Result: Less deprecated method in the code. --- .../test/java/io/netty/handler/proxy/ProxyHandlerTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/handler-proxy/src/test/java/io/netty/handler/proxy/ProxyHandlerTest.java b/handler-proxy/src/test/java/io/netty/handler/proxy/ProxyHandlerTest.java index 047b2af09b32..6f0f325d641a 100644 --- a/handler-proxy/src/test/java/io/netty/handler/proxy/ProxyHandlerTest.java +++ b/handler-proxy/src/test/java/io/netty/handler/proxy/ProxyHandlerTest.java @@ -35,6 +35,7 @@ import io.netty.channel.socket.nio.NioSocketChannel; import io.netty.handler.codec.LineBasedFrameDecoder; import io.netty.handler.ssl.SslContext; +import io.netty.handler.ssl.SslContextBuilder; import io.netty.handler.ssl.util.InsecureTrustManagerFactory; import io.netty.handler.ssl.util.SelfSignedCertificate; import io.netty.resolver.NoopAddressResolverGroup; @@ -91,8 +92,8 @@ public class ProxyHandlerTest { SslContext cctx; try { SelfSignedCertificate ssc = new SelfSignedCertificate(); - sctx = SslContext.newServerContext(ssc.certificate(), ssc.privateKey()); - cctx = SslContext.newClientContext(InsecureTrustManagerFactory.INSTANCE); + sctx = SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey()).build(); + cctx = SslContextBuilder.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE).build(); } catch (Exception e) { throw new Error(e); }