public void testTryBegin() throws Throwable {
    Assert.assertTrue(nonStopManager.tryBegin(10000));
    Assert.assertFalse(nonStopManager.tryBegin(10000));
    nonStopManager.finish();

    nonStopManager.begin(10000);
    Assert.assertFalse(nonStopManager.tryBegin(10000));
    nonStopManager.finish();

    Assert.assertTrue(nonStopManager.tryBegin(10000));
    try {
      nonStopManager.begin(-1);
      throw new AssertionError();
    } catch (IllegalStateException e) {
      // expected
    } finally {
      nonStopManager.finish();
    }
  }