From f8d587156798a694e5cfbf3afbed7d0beb2a8706 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 593a99f01b..02f4ac3a5e 100644 --- a/handler/src/test/java/io/netty/handler/ssl/SniHandlerTest.java +++ b/handler/src/test/java/io/netty/handler/ssl/SniHandlerTest.java @@ -368,10 +368,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(); }