@Override
    protected void decode(ChannelHandlerContext ctx, DatagramPacket msg,
                          List<Object> list) throws Exception {
        ByteBuf byteBuf = msg.content();
        LispMessageReader reader = LispMessageReaderFactory.getReader(byteBuf);
        LispMessage message = (LispMessage) reader.readFrom(byteBuf);
        message.configSender(msg.sender());
        list.add(message);
    }
@Test
    public void testDecode() throws Exception {
        LispMessageDecoder decoder = new LispMessageDecoder();
        DatagramPacket requestBuff = convToDatagram(getLispMapRequestBuffer());
        DatagramPacket replyBuff = convToDatagram(getLispMapReplyBuffer());
        DatagramPacket registerBuff = convToDatagram(getLispMapRegisterBuffer());
        DatagramPacket notifyBuff = convToDatagram(getLispMapNotifyBuffer());

        List<Object> list = Lists.newArrayList();
        decoder.decode(new ChannelHandlerContextAdapter(), requestBuff, list);
        decoder.decode(new ChannelHandlerContextAdapter(), replyBuff, list);
        decoder.decode(new ChannelHandlerContextAdapter(), registerBuff, list);
        decoder.decode(new ChannelHandlerContextAdapter(), notifyBuff, list);

        assertThat(list.size(), is(4));
        assertThat(list.get(0), is(instanceOf(LispMapRequest.class)));
        assertThat(list.get(1), is(instanceOf(LispMapReply.class)));
        assertThat(list.get(2), is(instanceOf(LispMapRegister.class)));
        assertThat(list.get(3), is(instanceOf(LispMapNotify.class)));
    }