@Test
  public void testNotEnoughMemory() throws Exception {
    final int size = 1024;
    final long capacity = 1024;
    final long maxBlockTimeInMs = 10;
    SimpleByteBufferPool pool = new SimpleByteBufferPool(capacity);
    pool.allocate(size, maxBlockTimeInMs);
    try {
      pool.allocate(size, maxBlockTimeInMs);
      fail("should have thrown.");
    } catch (TimeoutException e) {
    }
  }
This scenario tests when a {@link SimpleByteBufferPool} tries to allocate a {@link ByteBuffer} that is smaller
than the pool's capacity, but larger than the pool's current available memory. The operation will be blocking
until eventually be timed out and throw {@link TimeoutException}.
ambry-utils/src/test/java/com/github/ambry/utils/SimpleByteBufferPoolTest.java