@Test
  public void testExplicitServer() {
    manager = new ConnectionManagerImpl("pool", factory, endpointManager, 1, 0, -1, -1, logger,
        60 * 1000, cancelCriterion, poolStats);
    manager.start(background);

    Connection connection1 = manager.borrowConnection(0);

    Throwable thrown = catchThrowable(() -> {
      manager.borrowConnection(10);
    });
    assertThat(thrown).isInstanceOf(AllConnectionsInUseException.class);

    Connection connection2 =
        manager.borrowConnection(new ServerLocation("localhost", -2), 10, false);

    assertThat(factory.creates.get()).isEqualTo(2);
    assertThat(factory.destroys.get()).isEqualTo(0);
    assertThat(factory.closes.get()).isEqualTo(0);

    manager.returnConnection(connection2);

    assertThat(factory.creates.get()).isEqualTo(2);
    assertThat(factory.destroys.get()).isEqualTo(1);
    assertThat(factory.closes.get()).isEqualTo(1);

    manager.returnConnection(connection1);

    assertThat(factory.creates.get()).isEqualTo(2);
    assertThat(factory.destroys.get()).isEqualTo(1);
    assertThat(factory.closes.get()).isEqualTo(1);
  }
This tests that a deadlock between connection formation and connection pool closing has been
fixed. See GEODE-4615
geode-core/src/integrationTest/java/org/apache/geode/cache/client/internal/pooling/ConnectionManagerJUnitTest.java