Throttle(int maxPerPeriod, int periodMs) {
        this.maxPerPeriod = maxPerPeriod;
        this.periodMs = periodMs;
        this.count = maxPerPeriod;
        this.prevPeriod = -1;
        this.lastTimeMs = 0;
    }
@Test
    public void testThrottle() throws Exception {
        MockTime time = new MockTime(0, 0, 0);
        ThrottleMock throttle = new ThrottleMock(time, 3);
        assertFalse(throttle.increment());
        assertEquals(0, time.milliseconds());
        assertFalse(throttle.increment());
        assertEquals(0, time.milliseconds());
        assertFalse(throttle.increment());
        assertEquals(0, time.milliseconds());
        assertTrue(throttle.increment());
        assertEquals(100, time.milliseconds());
        time.sleep(50);
        assertFalse(throttle.increment());
        assertEquals(150, time.milliseconds());
        assertFalse(throttle.increment());
        assertEquals(150, time.milliseconds());
        assertTrue(throttle.increment());
        assertEquals(200, time.milliseconds());
    }