@Test
  public void testReceiverClosesConnectionIfMembershipCheckFailed() throws Exception {
    final Connection reader = createConnectionsAndWriteMessage(false, true, true);

    await().untilAsserted(() -> assertThat(assertThat(reader.isClosing()).isTrue()));
    verify(reader).readHandshakeForReceiver(any());
    verify(reader).requestClose("timed out during a membership check");
  }
Create a sender connection and a receiver connection and pass data from
one to the other.

This test uses a real socket, but mocks all other collaborators
of connection, such as the InternalDistributedSystem.
geode-core/src/test/java/org/apache/geode/internal/tcp/ConnectionTransmissionTest.java