public static <T> KryoCoder<T> of() {
    return of(PipelineOptionsFactory.create(), Collections.emptyList());
  }
@Test
  public void testCoderSerialization() throws IOException, ClassNotFoundException {
    final KryoRegistrar registrar = k -> k.register(ClassToBeEncoded.class);

    final KryoCoder<ClassToBeEncoded> coder = KryoCoder.of(OPTIONS, registrar);
    final ByteArrayOutputStream outStr = new ByteArrayOutputStream();
    final ObjectOutputStream oss = new ObjectOutputStream(outStr);

    oss.writeObject(coder);
    oss.flush();
    oss.close();

    ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(outStr.toByteArray()));
    @SuppressWarnings("unchecked")
    KryoCoder<ClassToBeEncoded> coderDeserialized = (KryoCoder<ClassToBeEncoded>) ois.readObject();

    assertEncoding(coder, coderDeserialized);
  }