@Test public void shouldLogByteBufHolderDataRead() throws Exception { ByteBufHolder msg = new DefaultByteBufHolder(Unpooled.copiedBuffer("hello", CharsetUtil.UTF_8)) { @Override public String toString() { return "foobar"; } }; appender.doAppend(matchesLog(".+RECEIVED: foobar, 5B$")); replay(appender); EmbeddedChannel channel = new EmbeddedChannel(new LoggingHandler()); channel.writeInbound(msg); verify(appender); ByteBufHolder handledMsg = channel.readInbound(); assertThat(msg, is(sameInstance(handledMsg))); handledMsg.release(); assertThat(channel.readInbound(), is(nullValue())); }
@Override public ByteBufHolder copy() { return new DefaultByteBufHolder(data.copy()); }
@Override public ByteBufHolder duplicate() { return new DefaultByteBufHolder(data.duplicate()); }