diff --git a/codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTest.java b/codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTest.java index 2938f86981..4fc1394924 100644 --- a/codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTest.java +++ b/codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTest.java @@ -27,7 +27,6 @@ import io.netty.channel.embedded.EmbeddedChannel; import io.netty.handler.codec.http.HttpMethod; import io.netty.handler.codec.http.HttpScheme; import io.netty.handler.codec.http2.Http2Exception.StreamException; -import io.netty.handler.codec.http2.LastInboundHandler.Consumer; import io.netty.util.AsciiString; import io.netty.util.AttributeKey; import io.netty.util.concurrent.Future; @@ -47,6 +46,7 @@ import java.util.concurrent.CompletionException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; import static io.netty.handler.codec.http2.Http2TestUtil.anyChannelPromise; import static io.netty.handler.codec.http2.Http2TestUtil.anyHttp2Settings; @@ -203,8 +203,8 @@ public abstract class Http2MultiplexTest { assertEquals(headersFrame, inboundHandler.readInbound()); - assertEqualsAndRelease(dataFrame1, inboundHandler.readInbound()); - assertEqualsAndRelease(dataFrame2, inboundHandler.readInbound()); + assertEqualsAndRelease(dataFrame1, inboundHandler.readInbound()); + assertEqualsAndRelease(dataFrame2, inboundHandler.readInbound()); assertNull(inboundHandler.readInbound()); } @@ -463,7 +463,7 @@ public abstract class Http2MultiplexTest { assertFalse(inboundHandler.isChannelActive()); // A RST_STREAM frame should NOT be emitted, as we received a RST_STREAM. - verify(frameWriter, Mockito.never()).writeRstStream(any(ChannelHandlerContext.class), eqStreamId(channel), + verify(frameWriter, never()).writeRstStream(any(ChannelHandlerContext.class), eqStreamId(channel), anyLong(), anyChannelPromise()); } @@ -885,8 +885,8 @@ public abstract class Http2MultiplexTest { assertEqualsAndRelease(dataFrame3, inboundHandler.readInbound()); assertEqualsAndRelease(dataFrame4, inboundHandler.readInbound()); - Http2ResetFrame resetFrame = useUserEventForResetFrame() ? inboundHandler.readUserEvent() : - inboundHandler.readInbound(); + Http2ResetFrame resetFrame = useUserEventForResetFrame() ? inboundHandler.readUserEvent() : + inboundHandler.readInbound(); assertEquals(childChannel.stream(), resetFrame.stream()); assertEquals(Http2Error.NO_ERROR.code(), resetFrame.errorCode()); @@ -1019,7 +1019,7 @@ public abstract class Http2MultiplexTest { frameInboundWriter.writeInboundData(childChannel.stream().id(), bb("1"), 0, false); - assertEqualsAndRelease(dataFrame1, inboundHandler.readInbound()); + assertEqualsAndRelease(dataFrame1, inboundHandler.readInbound()); // We want one item to be in the queue, and allow the numReads to be larger than 1. This will ensure that // when beginRead() is called the child channel is added to the readPending queue of the parent channel. @@ -1028,7 +1028,7 @@ public abstract class Http2MultiplexTest { numReads.set(2); childChannel.read(); - assertEqualsAndRelease(dataFrame2, inboundHandler.readInbound()); + assertEqualsAndRelease(dataFrame2, inboundHandler.readInbound()); assertNull(inboundHandler.readInbound()); @@ -1036,14 +1036,14 @@ public abstract class Http2MultiplexTest { // notify of readComplete(). frameInboundWriter.writeInboundData(childChannel.stream().id(), bb("3"), 0, false); - assertEqualsAndRelease(dataFrame3, inboundHandler.readInbound()); + assertEqualsAndRelease(dataFrame3, inboundHandler.readInbound()); frameInboundWriter.writeInboundData(childChannel.stream().id(), bb("4"), 0, false); assertNull(inboundHandler.readInbound()); childChannel.read(); - assertEqualsAndRelease(dataFrame4, inboundHandler.readInbound()); + assertEqualsAndRelease(dataFrame4, inboundHandler.readInbound()); assertNull(inboundHandler.readInbound()); diff --git a/codec-http2/src/test/java/io/netty/handler/codec/http2/LastInboundHandler.java b/codec-http2/src/test/java/io/netty/handler/codec/http2/LastInboundHandler.java index f7a8382059..bdc1648639 100644 --- a/codec-http2/src/test/java/io/netty/handler/codec/http2/LastInboundHandler.java +++ b/codec-http2/src/test/java/io/netty/handler/codec/http2/LastInboundHandler.java @@ -26,6 +26,7 @@ import io.netty.util.internal.PlatformDependent; import java.util.ArrayList; import java.util.List; import java.util.concurrent.locks.LockSupport; +import java.util.function.Consumer; import static java.util.Objects.requireNonNull; import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -41,11 +42,6 @@ public class LastInboundHandler implements ChannelHandler { private boolean channelActive; private String writabilityStates = ""; - // TODO(scott): use JDK 8's Consumer - public interface Consumer { - void accept(T obj); - } - private static final Consumer NOOP_CONSUMER = obj -> { }; @@ -55,7 +51,7 @@ public class LastInboundHandler implements ChannelHandler { } public LastInboundHandler() { - this(LastInboundHandler.noopConsumer()); + this(noopConsumer()); } public LastInboundHandler(Consumer channelReadCompleteConsumer) {