private int getAndUpdateSize(int defaultSize, AtomicReference<Integer> sizeOverride, boolean updateAllowed) {
            return sizeOverride.get() == null ? defaultSize
                : sizeOverride.updateAndGet(i -> updateAllowed ? Math.min(i * 2, defaultSize) : i);
          }
Helper method for incrementing the recommended buffer size for buffer expansion testing.
@param defaultSize the default size to use if an override is not present.
@param sizeOverride a reference to the current override value, the reference can be null if the override
                    is not enabled.
@param updateAllowed if the override size should be increased. If {@code true}, the size returned will
                     be double the last, capping out at {@code defaultSize}. Otherwise, the size returned
                     will be the same as last.
@return the recommended buffer size to return.
ambry-network/src/test/java/com/github/ambry/network/SSLSelectorTest.java