@Test
  public void test004ForCacheLoaderException() throws CacheException {
    final String name = getName();

    VM server = VM.getVM(0);
    VM client = VM.getVM(1);

    // Create the cache servers with distributed, mirrored region
    logger.info("before create server");

    server.invoke("Create Cache Server", () -> {
      CacheLoader<Object, Object> cl = new CacheLoader<Object, Object>() {
        @Override
        public Object load(LoaderHelper helper) {
          System.out.println("### CALLING CACHE LOADER....");
          throw new CacheLoaderException(
              "Test for CahceLoaderException causing Client connection to disconnect.");
        }

        @Override
        public void close() {}
      };
      RegionFactory<Object, Object> factory =
          getBridgeServerMirroredAckRegionAttributes(cl);
      createRegion(name, factory);
      startBridgeServer(0);
    });

    // Create cache server clients
    final int numberOfKeys = 10;
    final String host0 = NetworkUtils.getServerHostName();
    final int[] port =
        new int[] {server.invoke(ConnectionPoolDUnitTest::getCacheServerPort)};
    final String poolName = "myPool";

    logger.info("before create client");
    client.invoke("Create Cache Server Client", () -> {
      getLonerSystem();
      RegionFactory<Object, Object> factory = getCache().createRegionFactory();
      factory.setScope(Scope.LOCAL);
      factory.setConcurrencyChecksEnabled(false);
      // create bridge writer
      configureConnectionPoolWithNameAndFactory(factory, host0, port, true,
          -1, -1, null, poolName, PoolManager.createFactory(), -1, -1, -2, -1);
      createRegion(name, factory);
    });

    // Initialize each client with entries (so that afterInvalidate is called)

    logger.info("before initialize client");
    AsyncInvocation<Void> inv2 = client.invokeAsync("Initialize Client", () -> {
      Region<Object, Object> region = getRootRegion().getSubregion(name);
      PoolStats stats = ((PoolImpl) PoolManager.find(poolName)).getStats();
      int oldConnects = stats.getConnects();
      int oldDisConnects = stats.getDisConnects();
      for (int i = 0; i < numberOfKeys; i++) {
        region.get("key-" + i);
      }
      int newConnects = stats.getConnects();
      int newDisConnects = stats.getDisConnects();

      // newDisConnects);
      if (newConnects != oldConnects && newDisConnects != oldDisConnects) {
        fail("New connection has created for Server side CacheLoaderException.");
      }
    });

    ThreadUtils.join(inv2, 30 * 1000);
  }
Test for client connection loss with CacheLoader Exception on the server.
geode-core/src/distributedTest/java/org/apache/geode/cache/ConnectionPoolDUnitTest.java