From b2dbd4cedf75673f81da58febfbd00ec2c2a2c39 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Tue, 18 Feb 2020 15:05:15 +0100 Subject: [PATCH] Don't depend on implementation details of SSLEngine in SniHandlerTest (#10037) Motivation: In SniHandlerTest we depended on implementation details of the SSLEngine. We should better not doing this Modifications: Just release all outbound data Result: Dont depend on implementation details --- .../test/java/io/netty/handler/ssl/SniHandlerTest.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/handler/src/test/java/io/netty/handler/ssl/SniHandlerTest.java b/handler/src/test/java/io/netty/handler/ssl/SniHandlerTest.java index a730e389fc..9a0b39458a 100644 --- a/handler/src/test/java/io/netty/handler/ssl/SniHandlerTest.java +++ b/handler/src/test/java/io/netty/handler/ssl/SniHandlerTest.java @@ -370,10 +370,12 @@ public class SniHandlerTest { ch.close(); - // When the channel is closed the SslHandler will write an empty buffer to the channel. - ByteBuf buf = ch.readOutbound(); - if (buf != null) { - assertFalse(buf.isReadable()); + // Consume all the outbound data that may be produced by the SSLEngine. + for (;;) { + ByteBuf buf = ch.readOutbound(); + if (buf == null) { + break; + } buf.release(); }