EmbeddedChannel channel = new EmbeddedChannel(new StringEncoder());
Assert.assertTrue(channel.writeOutbound(msg));
Assert.assertTrue(channel.finish());
ByteBuf buf = channel.readOutbound();
byte[] data = new byte[buf.readableBytes()];
buf.readBytes(data);
Assert.assertArrayEquals(msg.getBytes(CharsetUtil.UTF_8), data);
Assert.assertNull(channel.readOutbound());
buf.release();
}
}