### Question:
SetAsyncInputMessageFactory implements OFSerializer<SetAsyncInput> { @Override public void serialize(SetAsyncInput message, ByteBuf outBuffer) { ByteBufUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, EncodeConstants.EMPTY_LENGTH); serializePacketInMask(message.getPacketInMask(), outBuffer); serializePortStatusMask(message.getPortStatusMask(), outBuffer); serializerFlowRemovedMask(message.getFlowRemovedMask(), outBuffer); ByteBufUtils.updateOFHeaderLength(outBuffer); }  @Override void serialize(SetAsyncInput message, ByteBuf outBuffer);  }### Answer:
@Test public void testSetAsyncInputMessage() throws Exception { SetAsyncInputBuilder builder = new SetAsyncInputBuilder(); BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID); builder.setPacketInMask(createPacketInMask()); builder.setPortStatusMask(createPortStatusMask()); builder.setFlowRemovedMask(createFlowRemowedMask()); SetAsyncInput message = builder.build(); ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer(); setAsyncFactory.serialize(message, out); BufferHelper.checkHeaderV13(out,(byte) 28, 32); Assert.assertEquals("Wrong packetInMask", 7, out.readUnsignedInt()); Assert.assertEquals("Wrong packetInMask", 0, out.readUnsignedInt()); Assert.assertEquals("Wrong portStatusMask", 7, out.readUnsignedInt()); Assert.assertEquals("Wrong portStatusMask", 0, out.readUnsignedInt()); Assert.assertEquals("Wrong flowRemovedMask", 15, out.readUnsignedInt()); Assert.assertEquals("Wrong flowRemovedMask", 0, out.readUnsignedInt()); }
@Test public void testSetAsyncInputWithNullMasks() throws Exception { SetAsyncInputBuilder builder = new SetAsyncInputBuilder(); BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID); builder.setPacketInMask(null); builder.setPortStatusMask(null); builder.setFlowRemovedMask(null); SetAsyncInput message = builder.build(); ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer(); setAsyncFactory.serialize(message, out); BufferHelper.checkHeaderV13(out,(byte) 28, 8); Assert.assertTrue("Unexpected data", out.readableBytes() == 0); }