@Override
	public ByteBuffer doDecode(ChannelHandlerContext ctx) {
		ByteBuffer buffer = ctx.getBuffer();
		buffer.mark();
		if (buffer.remaining() >= 2) {
			int len = buffer.getShort() & 0xffff;
			if (buffer.remaining() >= len) {
				ByteBuffer buff = ByteBuffer.wrap(buffer.array(),
						buffer.position(), len);
				buffer.position(buffer.position() + len);
				return buff;
			} else {
				buffer.reset();
			}
		}
		return null;
	}