@Test
public void synchronizationRequestQueuing() throws Throwable {

    setUp(this.nodeCount);
    this.host.joinNodesAndVerifyConvergence(this.host.getPeerCount());
    this.host.setNodeGroupQuorum(this.nodeCount);
    waitForReplicatedFactoryServiceAvailable(
            this.host.getPeerServiceUri(ExampleService.FACTORY_LINK),
            ServiceUriPaths.DEFAULT_NODE_SELECTOR);
    waitForReplicationFactoryConvergence();
    VerificationHost peerHost = this.host.getPeerHost();
    List<URI> exampleUris = this.host.createExampleServices(peerHost, 1, null);
    URI instanceUri = exampleUris.get(0);
    ExampleServiceState synchState = new ExampleServiceState();
    synchState.documentSelfLink = UriUtils.getLastPathSegment(instanceUri);
    TestContext ctx = this.host.testCreate(this.updateCount);
    for (int i = 0; i < this.updateCount; i++) {
        Operation op = Operation.createPost(peerHost, ExampleService.FACTORY_LINK)
                .setBody(synchState)
                .addPragmaDirective(Operation.PRAGMA_DIRECTIVE_SYNCH_OWNER)
                .setReferer(this.host.getUri())
                .setCompletion(ctx.getCompletion());
        this.host.sendRequest(op);
    }
    ctx.await();
    synchState.documentSelfLink = "unknown-service";
    TestContext notFoundCtx = this.host.testCreate(1);
    Operation notFoundOp = Operation
            .createPost(peerHost, ExampleService.FACTORY_LINK)
            .setBody(synchState)
            .addPragmaDirective(Operation.PRAGMA_DIRECTIVE_SYNCH_OWNER)
            .setReferer(this.host.getUri())
            .setCompletion((o, e) -> {
                if (e != null && o.getStatusCode() == Operation.STATUS_CODE_NOT_FOUND) {
                    notFoundCtx.completeIteration();
                    return;
                }
                notFoundCtx.failIteration(
                        new IllegalStateException("Failure expected with 404 NOT FOUND error"));
            });
    this.host.sendRequest(notFoundOp);
    notFoundCtx.await();
}