public long next() {
        final long duration;
        if (mDurations == null) {
            duration = mDuration;
        } else {
            duration = mDurations[mIndex];
            if (mIndex < mDurations.length - 1) {
                mIndex++;
            }
        }
        mNextTime = now() + duration;
        return duration;
    }
@Test
    public void testDelayOne() {
        final long millis = 5000;
        final Delay delay = new Delay(millis);
        for (int i = 0; i < 5; i++) {
            check(delay, millis);
            final long next = delay.next();
            Assert.assertEquals(millis, next);
        }
    }