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

    final Object callbackArg = "DESTROY CALLBACK";

    vm0.invoke("Create Cache Server", () -> {
      CacheWriter<Object, Object> cw = new TestCacheWriter<Object, Object>() {
        @Override
        public void beforeCreate2(EntryEvent event) throws CacheWriterException {

        }

        @Override
        public void beforeDestroy2(EntryEvent event) throws CacheWriterException {
          Object beca = event.getCallbackArgument();
          assertThat(callbackArg).isEqualTo(beca);
        }
      };
      RegionFactory<Object, Object> factory = getBridgeServerRegionAttributes(null, cw);
      createRegion(name, factory);
      startBridgeServer(0);
    });

    final int port = vm0.invoke(ConnectionPoolDUnitTest::getCacheServerPort);
    final String host0 = NetworkUtils.getServerHostName();

    vm1.invoke("Create and Load region", () -> {
      getLonerSystem();
      getCache();
      RegionFactory<Object, Object> factory = getCache().createRegionFactory();
      factory.setScope(Scope.LOCAL);
      factory.setConcurrencyChecksEnabled(false);

      configureConnectionPool(factory, host0, new int[] {port}, true, -1, -1, null);

      Region rgn = createRegion(name, factory);
      rgn.registerInterestRegex(".*", false, false);

      Region<Object, Object> region = getRootRegion().getSubregion(name);
      for (int i = 0; i < 10; i++) {
        region.put(i, String.valueOf(i));
      }
    });

    vm2.invoke("Create and Load region", () -> {
      getLonerSystem();
      getCache();
      RegionFactory<Object, Object> factory = getCache().createRegionFactory();
      factory.setScope(Scope.LOCAL);
      factory.setConcurrencyChecksEnabled(false);

      configureConnectionPool(factory, host0, new int[] {port}, true, -1, -1, null);

      Region rgn = createRegion(name, factory);
      rgn.registerInterestRegex(".*", false, false);

      Region<Object, Object> region = getRootRegion().getSubregion(name);
      for (int i = 0; i < 10; i++) {
        assertThat(String.valueOf(i)).isEqualTo(region.get(i));
      }
    });

    vm1.invoke("Local destroy", () -> {
      Region<Object, Object> region = getRootRegion().getSubregion(name);
      for (int i = 0; i < 10; i++) {
        region.localDestroy(i);
      }
    });

    vm2.invoke("No destroy propagate", () -> {
      Region<Object, Object> region = getRootRegion().getSubregion(name);
      for (int i = 0; i < 10; i++) {
        assertThat(String.valueOf(i)).isEqualTo(region.get(i));
      }
    });

    vm1.invoke("Fetch from server", () -> {
      Region<Object, Object> region = getRootRegion().getSubregion(name);
      for (int i = 0; i < 10; i++) {
        assertThat(String.valueOf(i)).isEqualTo(region.get(i));
      }
    });

    vm0.invoke("Check no server cache writer", () -> {
      Region<Object, Object> region = getRootRegion().getSubregion(name);
      TestCacheWriter writer = getTestWriter(region);
      writer.wasInvoked();
    });

    vm1.invoke(() -> {
      Region<Object, Object> region = getRootRegion().getSubregion(name);
      for (int i = 0; i < 10; i++) {
        region.destroy(i, callbackArg);
      }

      for (int i = 0; i < 10; i++) {
        final int testInt = i;
        await().until(() -> region.getEntry(testInt) == null);
      }
    });

    vm2.invoke("Validate destroy propagate", () -> {
      Region<Object, Object> region = getRootRegion().getSubregion(name);
      for (int i = 0; i < 10; i++) {
        final int testInt = i;
        await().until(() -> region.getEntry(testInt) == null);
      }
    });

    Stream.of(vm1, vm2).forEach(vm -> vm.invoke("Close Pool", () -> {
      Region<Object, Object> region = getRootRegion().getSubregion(name);
      region.localDestroyRegion();
    }));
  }
Tests that a {@link Region#localDestroy} is not propagated to the server and that a {@link
Region#destroy} is. Also makes sure that callback arguments are passed correctly.
geode-core/src/distributedTest/java/org/apache/geode/cache/ConnectionPoolDUnitTest.java