### Question:
ByteBufUtils { public static void updateOFHeaderLength(final ByteBuf out) { out.setShort(EncodeConstants.OFHEADER_LENGTH_INDEX, out.readableBytes()); } private  ByteBufUtils(); static String byteBufToHexString(final ByteBuf bb); static byte[] hexStringToBytes(final String hexSrc); static byte[] hexStringToBytes(final String hexSrc, final boolean withSpaces); static ByteBuf hexStringToByteBuf(final String hexSrc); static void hexStringToByteBuf(final String hexSrc, final ByteBuf out); @Deprecated static void padBuffer(final int length, final ByteBuf out); static void writeOFHeader(final byte msgType, final E message, final ByteBuf out, final int length); static void updateOFHeaderLength(final ByteBuf out); static void updateOFHeaderLength(final ByteBuf out, int index); static int fillBitMaskFromMap(final Map<Integer, Boolean> booleanMap); static int fillBitMask(final int offset, final boolean... values); static int[] fillBitMaskFromList(final List<Boolean> booleanList); static String bytesToHexString(final byte[] array); static byte[] macAddressToBytes(final String macAddress); static String macAddressToString(final byte[] address); static String decodeNullTerminatedString(final ByteBuf rawMessage, final int length); static String readIpv4Address(final ByteBuf buf); static String readIpv6Address(final ByteBuf buf); static Ipv4Address readIetfIpv4Address(final ByteBuf buf); static Ipv6Address readIetfIpv6Address(final ByteBuf buf); static MacAddress readIetfMacAddress(final ByteBuf buf); static byte[] serializeList(final List<Short> list); static final Splitter DOT_SPLITTER; static final Splitter COLON_SPLITTER; }### Answer:
@Test public void testUpdateHeader() throws IOException { ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); buffer.writeInt(1); int start = buffer.writerIndex(); buffer.writeShort(4); buffer.writeShort(EncodeConstants.EMPTY_LENGTH); buffer.writeLong(8); int end = buffer.writerIndex(); ByteBufUtils.updateOFHeaderLength(buffer, start); Assert.assertEquals(buffer.readInt(), 1); Assert.assertEquals(buffer.readShort(), 4); Assert.assertEquals(buffer.readShort(), 12); Assert.assertEquals(buffer.readLong(), 8l); Assert.assertEquals(buffer.getShort(start + EncodeConstants.OFHEADER_LENGTH_INDEX), end - start); }