@Test
  public void releaseParentChannelsIfPoolIsClosed() {
    SocketChannel channel = new NioSocketChannel();
    try {
      loopGroup.register(channel).awaitUninterruptibly();

      ChannelPool connectionPool = mock(ChannelPool.class);
      ArgumentCaptor<Promise> releasePromise = ArgumentCaptor.forClass(Promise.class);
      when(connectionPool.release(eq(channel), releasePromise.capture())).thenAnswer(invocation -> {
        Promise<?> promise = releasePromise.getValue();
        promise.setSuccess(null);
        return promise;
      });

      MultiplexedChannelRecord record = new MultiplexedChannelRecord(channel, 8, null, streamChannelInitializer);
      Http2MultiplexedChannelPool h2Pool =
          new Http2MultiplexedChannelPool(connectionPool, loopGroup, Collections.singleton(record), null,
              http2ClientConfigForOneConnection, new Http2ClientMetrics(new MetricRegistry()),
              streamChannelInitializer);

      h2Pool.close();

      InOrder inOrder = Mockito.inOrder(connectionPool);
      inOrder.verify(connectionPool).release(eq(channel), isA(Promise.class));
      inOrder.verify(connectionPool).close();
    } finally {
      channel.close().awaitUninterruptibly();
    }
  }
Channel acquire should fail if pool is closed.
ambry-network/src/test/java/com/github/ambry/network/http2/Http2MultiplexedChannelPoolTest.java