@Test
public void startProcess() throws Throwable {

    final ProcessState[] state = { new ProcessState() };
    if (host.getSystemInfo().osFamily == OsFamily.WINDOWS) {
        state[0].arguments = new String[] { "cmd.exe", "/C", "echo" };
    } else {
        state[0].arguments = new String[] { "echo" };
    }
    this.host.testStart(1);
    final URI[] processURI = { null };
    URI uri = UriUtils.buildUri(this.host, ProcessFactoryService.SELF_LINK);
    Operation op = Operation.createPost(uri)
            .setBody(state[0])
            .setCompletion((o, e) -> {
                if (e != null) {
                    this.host.failIteration(e);
                    return;
                }
                ProcessState newState = o.getBody(ProcessState.class);
                processURI[0] = UriUtils.buildUri(this.host, newState.documentSelfLink);
                this.host.completeIteration();
            });
    this.host.send(op);
    this.host.testWait();
    int startCount;
    int startDelayMillis;
    startCount = getStat(processURI[0], ProcessService.STAT_NAME_START_COUNT);
    assertTrue(startCount >= 1);
    Date expiration = this.host.getTestExpiration();
    while (new Date().before(expiration)) {
        startCount = getStat(processURI[0], ProcessService.STAT_NAME_START_COUNT);
        if (startCount >= 3) {
            // The process was restarted at least twice.
            // Test that the back-off kicked in after the first restart.
            startDelayMillis = getStat(processURI[0],
                    ProcessService.STAT_NAME_START_DELAY_MILLIS);
            assertTrue(startDelayMillis > 0);
            return;
        }
        Thread.sleep(TimeUnit.MICROSECONDS.toMillis(this.host.getMaintenanceIntervalMicros()));
    }
}