    @Test
    public void encode() {

        NettyProtocolEncoder nettyProtocolEncoder = new NettyProtocolEncoder();
        // build RpcDataPack
        RpcDataPack obj = new RpcDataPack();
        // set serial number
        obj.setSerialNo(123);
        List<ByteBuffer> dataList = new LinkedList<ByteBuffer>();
        dataList.add(ByteBuffer.wrap("abc".getBytes()));
        dataList.add(ByteBuffer.wrap("def".getBytes()));
        // append data list.
        obj.setDataLst(dataList);
        try {
            // encode data
            Object result = nettyProtocolEncoder.encode(null, null, obj);
            ChannelBuffer buf = (ChannelBuffer) result;
            // read data.
            int i = buf.readInt();
            i = buf.readInt();
            Assert.assertTrue(i == 123);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }