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

    vm0.invoke("Create Cache Server", () -> {
      RegionFactory<Object, Object> factory = getBridgeServerRegionAttributes(null, null);
      createRegion(name, factory);
      startBridgeServer(0);
    });

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

    vm1.invoke("Create 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);
      createRegion(name, factory);

      Region<Object, Object> region = getRootRegion().getSubregion(name);

      Throwable thrown =
          catchThrowable(() -> region.create(1, new ConnectionPoolTestNonSerializable()));

      assertThat(thrown).hasCauseInstanceOf(NotSerializableException.class);

      Throwable thrown2 =
          catchThrowable(() -> region.put(1, new ConnectionPoolTestNonSerializable()));
      assertThat(thrown2).hasCauseInstanceOf(NotSerializableException.class);

      Throwable thrown3 =
          catchThrowable(() -> region.get(new ConnectionPoolTestNonSerializable()));
      assertThat(thrown3).hasCauseInstanceOf(NotSerializableException.class);

      region.localDestroyRegion();
    });
  }
Tests that creating, putting and getting a non-serializable key or value throws the correct
(NotSerializableException) exception.
geode-core/src/distributedTest/java/org/apache/geode/cache/ConnectionPoolDUnitTest.java