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.
This commit is contained in:
parent
028d9dcf0f
commit
00afb19d7a
@ -35,6 +35,7 @@ import io.netty.channel.socket.SocketChannel;
|
|||||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||||
import io.netty.handler.codec.LineBasedFrameDecoder;
|
import io.netty.handler.codec.LineBasedFrameDecoder;
|
||||||
import io.netty.handler.ssl.SslContext;
|
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.InsecureTrustManagerFactory;
|
||||||
import io.netty.handler.ssl.util.SelfSignedCertificate;
|
import io.netty.handler.ssl.util.SelfSignedCertificate;
|
||||||
import io.netty.resolver.NoopAddressResolverGroup;
|
import io.netty.resolver.NoopAddressResolverGroup;
|
||||||
@ -91,8 +92,8 @@ public class ProxyHandlerTest {
|
|||||||
SslContext cctx;
|
SslContext cctx;
|
||||||
try {
|
try {
|
||||||
SelfSignedCertificate ssc = new SelfSignedCertificate();
|
SelfSignedCertificate ssc = new SelfSignedCertificate();
|
||||||
sctx = SslContext.newServerContext(ssc.certificate(), ssc.privateKey());
|
sctx = SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey()).build();
|
||||||
cctx = SslContext.newClientContext(InsecureTrustManagerFactory.INSTANCE);
|
cctx = SslContextBuilder.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE).build();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new Error(e);
|
throw new Error(e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user