@Test
  public void testLazyLoner() throws Exception {
    // Test that we can become a peer registry
    {
      initCache(false, false, null);
      // This should work, because this is a peer.
      defineAType();
    }
    tearDown();
    setUp();

    // Test that we can become a client registry.
    {
      initCache(false, false, null);
      int port = AvailablePortHelper.getRandomAvailableTCPPort();
      PoolManager.createFactory().addServer("localhost", port).create("pool");

      Throwable thrown = catchThrowable(this::defineAType);
      assertThat(thrown).isExactlyInstanceOf(ToDataException.class);
    }
  }
Test that loner VMs lazily determine if they are a client or a peer.
geode-core/src/distributedTest/java/org/apache/geode/pdx/PdxAttributesDistributedTest.java