diff --git a/handler/src/main/java/io/netty/handler/stream/ChunkedStream.java b/handler/src/main/java/io/netty/handler/stream/ChunkedStream.java index 5df64cc2ae..2dc176c60e 100644 --- a/handler/src/main/java/io/netty/handler/stream/ChunkedStream.java +++ b/handler/src/main/java/io/netty/handler/stream/ChunkedStream.java @@ -84,6 +84,9 @@ public class ChunkedStream implements ChunkedInput { if (closed) { return true; } + if (in.available() > 0) { + return false; + } int b = in.read(); if (b < 0) { diff --git a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketChannelConfigTest.java b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketChannelConfigTest.java index b2b35c17d9..4b0d19be6d 100644 --- a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketChannelConfigTest.java +++ b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketChannelConfigTest.java @@ -156,7 +156,7 @@ public class EpollSocketChannelConfigTest { if (!(e.getCause() instanceof ClosedChannelException)) { AssertionError error = new AssertionError( "Expected the suppressed exception to be an instance of ClosedChannelException."); - error.addSuppressed(e.getCause()); + error.addSuppressed(e); throw error; } }