@BeforeClass
  public static void beforeClass() {
    Instantiator.register(new Instantiator(Payload.class, (byte) 22) {
      @Override
      public DataSerializable newInstance() {
        return new Payload();
      }
    });
    Instantiator.register(new Instantiator(Key.class, (byte) 21) {
      @Override
      public DataSerializable newInstance() {
        return new Key();
      }
    });
  }
This class makes sure that instantatiors are persisted to disk and can be recovered.
geode-core/src/integrationTest/java/org/apache/geode/DiskInstantiatorsJUnitTest.java