@Test
  public void testLazyLoadingOfDataSerializersWith2ClientsN2Servers() throws Exception {
    PORT1 = initServerCache(server1);
    PORT2 = initServerCache(server2);

    client2.bounce();

    client1.invoke(() -> DataSerializerPropagationDUnitTest
        .createClientCache(NetworkUtils.getServerHostName(server1.getHost()), PORT1));
    client2.invoke(() -> DataSerializerPropagationDUnitTest
        .createClientCache(NetworkUtils.getServerHostName(server1.getHost()), PORT2));

    client1.invoke(() -> registerDataSerializer(TestDataSerializer.class));

    client1.invoke(() -> DataSerializerPropagationDUnitTest.verifyDataSerializers(1));

    // Verify through InternalDataSerializer's map entries
    client1.invoke(
        () -> DataSerializerPropagationDUnitTest.verifyLoadedDataSerializers(1));
    client1.invoke(
        () -> DataSerializerPropagationDUnitTest.verifyDataSerializerClassNamesMap(0));
    client1
        .invoke(() -> DataSerializerPropagationDUnitTest.verifyDataSerializerIDMap(0));
    client1.invoke(() -> DataSerializerPropagationDUnitTest
        .verifyDataSerializerSupportedClassNamesMap(0));

    server1.invoke(
        () -> DataSerializerPropagationDUnitTest.verifyLoadedDataSerializers(1));
    server1.invoke(
        () -> DataSerializerPropagationDUnitTest.verifyDataSerializerClassNamesMap(0));
    server1
        .invoke(() -> DataSerializerPropagationDUnitTest.verifyDataSerializerIDMap(0));
    server1.invoke(() -> DataSerializerPropagationDUnitTest
        .verifyDataSerializerSupportedClassNamesMap(0));

    server2.invoke(
        () -> DataSerializerPropagationDUnitTest.verifyLoadedDataSerializers(1));
    server2.invoke(
        () -> DataSerializerPropagationDUnitTest.verifyDataSerializerClassNamesMap(0));
    server2
        .invoke(() -> DataSerializerPropagationDUnitTest.verifyDataSerializerIDMap(0));
    server2.invoke(() -> DataSerializerPropagationDUnitTest
        .verifyDataSerializerSupportedClassNamesMap(0));

    // Verify by boolean flag in static initializer.
    server1.invoke(DataSerializerPropagationDUnitTest::verifyTestDataSerializerLoaded);
    server2.invoke(DataSerializerPropagationDUnitTest::verifyTestDataSerializerLoaded);
    client2.invoke(DataSerializerPropagationDUnitTest::verifyTestDataSerializerNotLoaded);

    // Verify through InternalDataSerializer.getSerializers()
    server1.invoke(() -> DataSerializerPropagationDUnitTest.verifyDataSerializers(1));
    server2.invoke(() -> DataSerializerPropagationDUnitTest.verifyDataSerializers(1));

    // Verify through InternalDataSerializer's map entries
    client2.invoke(
        () -> DataSerializerPropagationDUnitTest.verifyLoadedDataSerializers(0));
    client2.invoke(
        () -> DataSerializerPropagationDUnitTest.verifyDataSerializerClassNamesMap(1));
    client2
        .invoke(() -> DataSerializerPropagationDUnitTest.verifyDataSerializerIDMap(1));
    client2.invoke(() -> DataSerializerPropagationDUnitTest
        .verifyDataSerializerSupportedClassNamesMap(3));

    // Force TestDataSerializer to be loaded into vm by invoking
    // InternalDataSerialier.getSerializers()
    client2.invoke(() -> DataSerializerPropagationDUnitTest.verifyDataSerializers(1));

    // Verify by boolean flag in static initializer.
    client2.invoke(DataSerializerPropagationDUnitTest::verifyTestDataSerializerLoaded);
    // Verify through InternalDataSerializer's map entries
    client2.invoke(
        () -> DataSerializerPropagationDUnitTest.verifyLoadedDataSerializers(1));
    client2.invoke(
        () -> DataSerializerPropagationDUnitTest.verifyDataSerializerClassNamesMap(0));
    client2
        .invoke(() -> DataSerializerPropagationDUnitTest.verifyDataSerializerIDMap(0));
    client2.invoke(() -> DataSerializerPropagationDUnitTest
        .verifyDataSerializerSupportedClassNamesMap(0));
  }
Register two DataSerializers on the server and verify that they get propagated to client.
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/DataSerializerPropagationDUnitTest.java