@Test
  public void testUDDS2() throws Exception {
    assertThat(Class_testSupportedClasses3.wasInvoked).isFalse();
    assertThat(Class_testSupportedClasses3.toDataInvoked).isFalse();
    assertThat(Class_testSupportedClasses3.fromDataInvoked).isFalse();

    DataSerializer ds2 = DataSerializer.register(Class_testSupportedClasses3.class);
    int id2 = ds2.getId();

    try {
      Object o = new NonDataSerializable(new Random());
      DataSerializer.writeObject(o, getDataOutput());
      assertThat(Class_testSupportedClasses3.wasInvoked).isTrue();
      assertThat(Class_testSupportedClasses3.toDataInvoked).isTrue();
      assertThat(Class_testSupportedClasses3.fromDataInvoked).isFalse();

      Object o2 = DataSerializer.readObject(getDataInput());
      assertThat(Class_testSupportedClasses3.fromDataInvoked).isTrue();
      assertThat(o).isEqualTo(o2);
    } finally {
      InternalDataSerializer.unregister(id2);
    }

    Class_testSupportedClasses3.wasInvoked = false;
    Class_testSupportedClasses3.toDataInvoked = false;
    Class_testSupportedClasses3.fromDataInvoked = false;
  }
Make sure a user defined ds with an id of 2 bytes works.
geode-core/src/test/java/org/apache/geode/internal/DataSerializableJUnitTest.java