@Test
public void updatesWithForcedFailure() throws Throwable {

    long serviceCount = 1;
    List<Service> services = this.host.doThroughputServiceStart(serviceCount,
            MinimalTestService.class,
            this.host.buildMinimalTestState(),
            null, null);
    verifyErrorResponseBodyHandling(services);
    // induce a failure that does warrant a retry. Verify we do get proper retries
    verifyRequestRetryPolicy(services);
    this.host.doPutPerService(
            EnumSet.of(TestProperty.FORCE_FAILURE,
                    TestProperty.SINGLE_ITERATION),
            services);
    this.host.doPutPerService(
            EnumSet.of(TestProperty.FORCE_REMOTE, TestProperty.FORCE_FAILURE,
                    TestProperty.SINGLE_ITERATION),
            services);
    // send some garbage that the service will not even be able to parse
    this.host.testStart(1);
    this.host.send(Operation.createPut(services.get(0).getUri())
            .setBody("this is not JSON")
            .setCompletion(this.host.getExpectedFailureCompletion()));
    this.host.testWait();
    // do the same, forceRemote to go over socket I/O
    this.host.testStart(1);
    this.host.send(Operation.createPut(services.get(0).getUri())
            .setBody("this is not JSON")
            .forceRemote()
            .setCompletion(this.host.getExpectedFailureCompletion()));
    this.host.testWait();
    // request that the service fails the request but returns corrupted JSON
    MinimalTestServiceState body = new MinimalTestServiceState();
    this.host.testStart(1);
    body.id = MinimalTestService.STRING_MARKER_FAIL_REQUEST_WITH_CORRUPTED_JSON_RSP;
    this.host.send(Operation.createPatch(services.get(0).getUri())
            .setBody(body)
            .forceRemote()
            .setCompletion(this.host.getExpectedFailureCompletion()));
    this.host.testWait();
    // create an operation with no body and verify completion gets called with
    // failure
    this.host.testStart(1);
    this.host.send(Operation.createPatch(services.get(0).getUri())
            .setCompletion(this.host.getExpectedFailureCompletion()));
    this.host.testWait();
    this.host.testStart(1);
    this.host.send(Operation.createPatch(services.get(0).getUri())
            .forceRemote()
            .setCompletion(this.host.getExpectedFailureCompletion()));
    this.host.testWait();
}