@Test
  public void enforceMaxNumberOfStreamTest() {
    EmbeddedChannel channel = newHttp2Channel();
    int maxConcurrentStreams = 10;
    int totalStreams = 20;
    MultiplexedChannelRecord record =
        new MultiplexedChannelRecord(channel, maxConcurrentStreams, null, streamChannelInitializer);

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

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

    for (long i = maxConcurrentStreams; i < totalStreams; i++) {
      Promise<Channel> streamPromise = channel.eventLoop().newPromise();
      assertFalse(record.acquireStream(streamPromise));
    }

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

    assertTrue(channel.isOpen());

    channel.runPendingTasks();
    Assert.assertEquals(record.getNumOfAvailableStreams().get(), maxConcurrentStreams);
  }
False from acquireStream() is expected if run out of streams.
ambry-network/src/test/java/com/github/ambry/network/http2/MultiplexedChannelRecordTest.java