@Override
  public boolean attempt() {
    if (mFirstAttempt || (CommonUtils.getCurrentMs() - mLastAttempTimeMs) > mRefreshPeriodMs) {
      mLastAttempTimeMs = CommonUtils.getCurrentMs();
      mFirstAttempt = false;
      return true;
    }
    return false;
  }
@Test
  public void timeout() {
    final long timeoutMs = 500;
    final long slackMs = 200;
    TimeoutRefresh timeoutRefresh = new TimeoutRefresh(timeoutMs);
    // First check, should attempt
    assertTrue(timeoutRefresh.attempt());
    // Second check, should not attempt before refresh timeout
    assertFalse(timeoutRefresh.attempt());

    CommonUtils.sleepMs(timeoutMs);
    CommonUtils.sleepMs(slackMs);

    assertTrue(timeoutRefresh.attempt());
    assertFalse(timeoutRefresh.attempt());
  }