@Test
  public void sharedSenderShouldRecoverFromClosedSocket() {
    // Create a region in each member. VM0 has a proxy region, so state must be in VM1
    vm0.invoke(() -> {
      getCache().createRegionFactory(RegionShortcut.REPLICATE_PROXY).create("region");
    });
    vm1.invoke(() -> {
      getCache().createRegionFactory(RegionShortcut.REPLICATE).create("region");
    });


    // Force VM1 to close it's connections.
    vm1.invoke(() -> {
      ConnectionTable conTable = getConnectionTable();
      assertThat(conTable.getNumberOfReceivers()).isEqualTo(2);
      conTable.closeReceivers(false);
      await().untilAsserted(() -> assertThat(conTable.getNumberOfReceivers()).isEqualTo(0));
    });

    // See if VM0 noticed the closed connections. Try to do a couple of region
    // operations
    vm0.invoke(() -> {
      Region<Object, Object> region = getCache().getRegion("region");
      region.put("1", "1");

      assertThat(region.get("1")).isEqualTo("1");
    });

    // Make sure connections were reestablished
    vm1.invoke(() -> {
      ConnectionTable conTable = getConnectionTable();
      await().untilAsserted(() -> assertThat(conTable.getNumberOfReceivers()).isEqualTo(2));
    });

    // Make sure the Sender connection has a reader thread
    vm1.invoke(() -> {
      ConnectionTable conTable = getConnectionTable();
      InternalDistributedSystem distributedSystem = getCache().getInternalDistributedSystem();
      InternalDistributedMember otherMember = distributedSystem.getDistributionManager()
          .getOtherNormalDistributionManagerIds().iterator().next();
      Connection connection = conTable.getConduit().getConnection(otherMember, true,
          System.currentTimeMillis(), 15000, 0);
      await().untilAsserted(() -> {
        // grab the shared, ordered "sender" connection to vm0. It should have a residual
        // reader thread that exists to detect that the socket has been closed.
        ConnectionTable.threadWantsSharedResources();
        assertThat(connection.hasResidualReaderThread()).isTrue();
      });
    });
  }
The test case in this class requires that conserve-sockets=true in order for the connections to
be shared.
geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/CloseConnectionTest.java