@Override public ChannelBuffer encode(LevelColorMessage message) throws IOException { ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); ChannelBufferUtils.writeString(buffer, message.getType()); buffer.writeInt(message.getValue()); return buffer; }
@Override public LevelColorMessage decode(ChannelBuffer buffer) throws IOException { String type = ChannelBufferUtils.readString(buffer); int value = buffer.readInt(); return new LevelColorMessage(type, value); }