public static <T> LengthPrefixCoder<T> of(Coder<T> valueCoder) {
    checkNotNull(valueCoder, "Coder not expected to be null");
    return new LengthPrefixCoder<>(valueCoder);
  }
@Test
  public void testMultiCoderCycle() throws Exception {
    LengthPrefixCoder<Long> lengthPrefixedValueCoder =
        LengthPrefixCoder.of(BigEndianLongCoder.of());

    LengthPrefixCoder<byte[]> lengthPrefixedBytesCoder = LengthPrefixCoder.of(ByteArrayCoder.of());

    // [0x08, 0, 0, 0, 0, 0, 0, 0, 0x16]
    byte[] userEncoded = CoderUtils.encodeToByteArray(lengthPrefixedValueCoder, 22L);

    // [0, 0, 0, 0, 0, 0, 0, 0x16]
    byte[] decodedToBytes = CoderUtils.decodeFromByteArray(lengthPrefixedBytesCoder, userEncoded);

    // [0x08, 0, 0, 0, 0, 0, 0, 0, 0x16]
    byte[] reencodedBytes = CoderUtils.encodeToByteArray(lengthPrefixedBytesCoder, decodedToBytes);

    long userDecoded = CoderUtils.decodeFromByteArray(lengthPrefixedValueCoder, reencodedBytes);

    assertFalse(
        "Length-prefix decoding to bytes should drop the length",
        Arrays.equals(userEncoded, decodedToBytes));
    assertArrayEquals(userEncoded, reencodedBytes);
    assertEquals(22L, userDecoded);
  }