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(); }