static long calculateFailedRequestDelay(int failures, TimingValues timingValues) {
        long delay = timingValues.getFixedDelay() * (long)Math.pow(2, failures);
        delay = Math.max(timingValues.getFixedDelay(), Math.min(60_000, delay)); // between timingValues.getFixedDelay() and 60 seconds
        delay = timingValues.getPlusMinusFractionRandom(delay, randomFraction);

        return delay;
    }
@Test
    public void testDelayCalculation() {
        TimingValues defaultTimingValues = new TimingValues();
        Random random = new Random(0); // Use seed to make delays deterministic
        TimingValues timingValues = new TimingValues(defaultTimingValues, random);

        int failures = 1;
        // First time failure
        long delay = calculateFailedRequestDelay(failures, timingValues);
        assertEquals(10924, delay);

        failures++;
        // 2nd time failure
        delay = calculateFailedRequestDelay(failures, timingValues);
        assertEquals(22652, delay);

        failures++;
        // 3rd time failure
        delay = calculateFailedRequestDelay(failures, timingValues);
        assertEquals(35849, delay);
    }