@Test
  public void streamAcquireReleaseTest() {
    EmbeddedChannel channel = newHttp2Channel();
    int maxConcurrentStreams = 100;
    int testStreams = 10;
    MultiplexedChannelRecord record =
        new MultiplexedChannelRecord(channel, maxConcurrentStreams, null, streamChannelInitializer);

    List<Promise<Channel>> streamPromises = new ArrayList<>();

    for (int i = 0; i < 10; i++) {
      Promise<Channel> streamPromise = channel.eventLoop().newPromise();
      record.acquireStream(streamPromise);
      streamPromises.add(streamPromise);
    }

    channel.runPendingTasks();
    for (Promise<Channel> streamPromise : streamPromises) {
      assertTrue(streamPromise.isSuccess());
      assertTrue(channel.isOpen());
    }

    Assert.assertEquals(record.getNumOfAvailableStreams().get(), maxConcurrentStreams - testStreams);

    for (Promise<Channel> streamPromise : streamPromises) {
      record.closeAndReleaseChild(streamPromise.getNow());
    }

    assertTrue(channel.isOpen());

    channel.runPendingTasks();
    Assert.assertEquals(record.getNumOfAvailableStreams().get(), maxConcurrentStreams);

    assertTrue(channel.isOpen());
  }
Regular stream acquire and release test.
ambry-network/src/test/java/com/github/ambry/network/http2/MultiplexedChannelRecordTest.java