KryoState { static KryoState get(KryoCoder<?> coder) { return STORAGE.getOrCreate(coder); } private  KryoState(
      Kryo kryo, int firstRegistrationId, InputChunked inputChunked, OutputChunked outputChunked); int getFirstRegistrationId();  }
@Test public void testSameKryoAfterDeserialization() throws IOException, ClassNotFoundException { final KryoCoder<?> coder = KryoCoder.of(k -> k.register(TestClass.class)); final KryoState firstKryo = KryoState.get(coder); final ByteArrayOutputStream outStr = new ByteArrayOutputStream(); final ObjectOutputStream oss = new ObjectOutputStream(outStr); oss.writeObject(coder); oss.flush(); oss.close(); final ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(outStr.toByteArray())); @SuppressWarnings("unchecked") final KryoCoder<?> deserializedCoder = (KryoCoder) ois.readObject(); final KryoState secondKryo = KryoState.get(deserializedCoder); assertSame(firstKryo, secondKryo); }