@Test public void testSerialize() { EchoRequestMessageFactory serializer = new EchoRequestMessageFactory(); SerializerRegistry registry = new NetIdeSerializerRegistryImpl(); registry.init(); ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(message, serializedBuffer); BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 24); Assert.assertArrayEquals("Wrong data", message.getData(), serializedBuffer.readBytes(serializedBuffer.readableBytes()).array()); }
@Override public void serialize(EchoRequestMessage message, ByteBuf outBuffer) { ByteBufUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, EncodeConstants.EMPTY_LENGTH); byte[] data = message.getData(); if (data != null) { outBuffer.writeBytes(data); } ByteBufUtils.updateOFHeaderLength(outBuffer); }
EchoRequestMessageFactory implements OFSerializer<EchoRequestMessage> { @Override public void serialize(EchoRequestMessage message, ByteBuf outBuffer) { ByteBufUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, EncodeConstants.EMPTY_LENGTH); byte[] data = message.getData(); if (data != null) { outBuffer.writeBytes(data); } ByteBufUtils.updateOFHeaderLength(outBuffer); } }
EchoRequestMessageFactory implements OFSerializer<EchoRequestMessage> { @Override public void serialize(EchoRequestMessage message, ByteBuf outBuffer) { ByteBufUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, EncodeConstants.EMPTY_LENGTH); byte[] data = message.getData(); if (data != null) { outBuffer.writeBytes(data); } ByteBufUtils.updateOFHeaderLength(outBuffer); }  }
EchoRequestMessageFactory implements OFSerializer<EchoRequestMessage> { @Override public void serialize(EchoRequestMessage message, ByteBuf outBuffer) { ByteBufUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, EncodeConstants.EMPTY_LENGTH); byte[] data = message.getData(); if (data != null) { outBuffer.writeBytes(data); } ByteBufUtils.updateOFHeaderLength(outBuffer); }  @Override void serialize(EchoRequestMessage message, ByteBuf outBuffer); }
EchoRequestMessageFactory implements OFSerializer<EchoRequestMessage> { @Override public void serialize(EchoRequestMessage message, ByteBuf outBuffer) { ByteBufUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, EncodeConstants.EMPTY_LENGTH); byte[] data = message.getData(); if (data != null) { outBuffer.writeBytes(data); } ByteBufUtils.updateOFHeaderLength(outBuffer); }  @Override void serialize(EchoRequestMessage message, ByteBuf outBuffer);  }