@Test(timeout = 5_000)
  public void interruptDuringClosePreservesFlag() throws InterruptedException {
    SocketChannel channel = new NioSocketChannel();
    try {
      loopGroup.register(channel).awaitUninterruptibly();
      Promise<Channel> channelPromise = new DefaultPromise<>(loopGroup.next());
      channelPromise.setSuccess(channel);

      ChannelPool connectionPool = mock(ChannelPool.class);
      Promise<Void> releasePromise = Mockito.spy(new DefaultPromise<>(loopGroup.next()));

      when(connectionPool.release(eq(channel))).thenReturn(releasePromise);

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

      CompletableFuture<Boolean> interrupteFlagPreserved = new CompletableFuture<>();

      Thread t = new Thread(() -> {
        try {
          h2Pool.close();
        } catch (Exception e) {
          if (e.getCause() instanceof InterruptedException && Thread.currentThread().isInterrupted()) {
            interrupteFlagPreserved.complete(true);
          }
        }
      });

      t.start();
      t.interrupt();
      t.join();
      assertTrue(interrupteFlagPreserved.join());
    } finally {
      channel.close().awaitUninterruptibly();
    }
  }
Interrupt flag is preserved if pool close is interrupted.
ambry-network/src/test/java/com/github/ambry/network/http2/Http2MultiplexedChannelPoolTest.java