@Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
        out.add(msg.toString(charset));
    }
@Test
    public void testDecode() {
        String msg = "abc123";
        ByteBuf byteBuf = Unpooled.copiedBuffer(msg, CharsetUtil.UTF_8);
        EmbeddedChannel channel = new EmbeddedChannel(new StringDecoder());
        assertTrue(channel.writeInbound(byteBuf));
        String result = channel.readInbound();
        assertEquals(msg, result);
        assertNull(channel.readInbound());
        assertFalse(channel.finish());
    }