From 8a24df88a4ff5519176767aee01bf6186015d471 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Thu, 8 Nov 2018 15:22:33 +0100 Subject: [PATCH] Ensure we correctly call wrapEngine(...) during tests. (#8473) Motivation: We should call wrapEngine(...) in our SSLEngineTest to correctly detect all errors in case of the OpenSSLEngine. Modifications: Add missing wrapEngine(...) calls. Result: More correct tests --- .../src/test/java/io/netty/handler/ssl/SSLEngineTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java b/handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java index ba2cdf2c22..4de0bd8d0f 100644 --- a/handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java +++ b/handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java @@ -969,7 +969,7 @@ public abstract class SSLEngineTest { ch.config().setAllocator(new TestByteBufAllocator(ch.config().getAllocator(), type)); ChannelPipeline p = ch.pipeline(); - SSLEngine engine = serverSslCtx.newEngine(ch.alloc()); + SSLEngine engine = wrapEngine(serverSslCtx.newEngine(ch.alloc())); engine.setUseClientMode(false); engine.setNeedClientAuth(true); @@ -1679,7 +1679,7 @@ public abstract class SSLEngineTest { @Override protected void initChannel(Channel ch) throws Exception { ch.config().setAllocator(new TestByteBufAllocator(ch.config().getAllocator(), type)); - ch.pipeline().addLast(new SslHandler(clientSslCtx.newEngine(ch.alloc()))); + ch.pipeline().addLast(new SslHandler(wrapEngine(clientSslCtx.newEngine(ch.alloc())))); } }).connect(serverChannel.localAddress()).syncUninterruptibly().channel(); @@ -2649,7 +2649,7 @@ public abstract class SSLEngineTest { try { serverSslCtx = SslContextBuilder.forServer(cert.key(), cert.cert()).sslProvider(sslClientProvider()) .ciphers(cipherList).build(); - server = serverSslCtx.newEngine(UnpooledByteBufAllocator.DEFAULT); + server = wrapEngine(serverSslCtx.newEngine(UnpooledByteBufAllocator.DEFAULT)); fail(); } catch (IllegalArgumentException expected) { // expected when invalid cipher is used.