private void serializeAndDeserializeSanctionedObject(Object object) throws Exception {
    BufferDataOutputStream outputStream = new BufferDataOutputStream(KnownVersion.CURRENT);

    try {
      serializeObject(object, outputStream);
    } catch (RemoteException e) {
      // java.rmi.server.RemoteObject which is not supported by AnalyzeSerializables
    } catch (Exception e) {
      errorCollector.addError(
          new AssertionError("I was unable to serialize " + object.getClass().getName(), e));
    }

    try {
      deserializeObject(outputStream);
    } catch (CancelException e) {
      // PDX classes fish for a PDXRegistry and find that there is no cache
    } catch (Exception e) {
      errorCollector.addError(
          new AssertionError("I was unable to deserialize " + object.getClass().getName(), e));
    }
  }
This subclass of AbstractAnalyzeSerializablesTestBase uses DataSerializer and
InternalDataSerializer. It also performs initialization of the Geode TypeRegistry
geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesTestBase.java