### Question:
OF10PortModInputMessageFactory implements OFSerializer<PortModInput> { @Override public void serialize(final PortModInput message, final ByteBuf outBuffer) { ByteBufUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, EncodeConstants.EMPTY_LENGTH); outBuffer.writeShort(message.getPortNo().getValue().intValue()); outBuffer.writeBytes(IetfYangUtil.INSTANCE.bytesFor(message.getHwAddress())); outBuffer.writeInt(createPortConfigBitmask(message.getConfigV10())); outBuffer.writeInt(createPortConfigBitmask(message.getMaskV10())); outBuffer.writeInt(createPortFeaturesBitmask(message.getAdvertiseV10())); outBuffer.writeZero(PADDING_IN_PORT_MOD_MESSAGE); ByteBufUtils.updateOFHeaderLength(outBuffer); }  @Override void serialize(final PortModInput message, final ByteBuf outBuffer);  }### Answer:
@Test public void testPortModInput() throws Exception { PortModInputBuilder builder = new PortModInputBuilder(); BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID); builder.setPortNo(new PortNumber(6633L)); builder.setHwAddress(new MacAddress("08:00:27:00:B0:EB")); builder.setConfigV10(new PortConfigV10(true, false, false, true, false, false, true)); builder.setMaskV10(new PortConfigV10(false, true, true, false, false, true, false)); builder.setAdvertiseV10(new PortFeaturesV10(true, true, false, false, false, false, false, true, true, false, false, false)); PortModInput message = builder.build(); ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer(); portModFactory.serialize(message, out); BufferHelper.checkHeaderV10(out, (byte) 15, 32); Assert.assertEquals("Wrong PortNo", message.getPortNo().getValue().longValue(), out.readUnsignedShort()); byte[] address = new byte[6]; out.readBytes(address); Assert.assertEquals("Wrong MacAddress", message.getHwAddress(), new MacAddress(ByteBufUtils.macAddressToString(address))); Assert.assertEquals("Wrong config", 21, out.readUnsignedInt()); Assert.assertEquals("Wrong mask", 98, out.readUnsignedInt()); Assert.assertEquals("Wrong advertise", 652, out.readUnsignedInt()); out.skipBytes(4); }