@Test
public void completion() throws Throwable {

    boolean[] isSuccessHandlerCalled = new boolean[] { false };
    boolean[] isFailureHandlerCalled = new boolean[] { false };
    Consumer<Operation> successHandler = op -> isSuccessHandlerCalled[0] = true;
    CompletionHandler failureHandler = (op, e) -> isFailureHandlerCalled[0] = true;
    Operation successOp = getOperationSuccess().setCompletion(successHandler, failureHandler);
    wrapCompletionHandlerWithCompleteIteration(successOp);
    this.host.sendAndWait(successOp);
    assertTrue("op success should call success handler", isSuccessHandlerCalled[0]);
    assertFalse("op success should NOT call success handler", isFailureHandlerCalled[0]);
    // reset the flags
    isSuccessHandlerCalled[0] = false;
    isFailureHandlerCalled[0] = false;
    Operation failureOp = getOperationFailure().setCompletion(successHandler, failureHandler);
    wrapCompletionHandlerWithCompleteIteration(failureOp);
    this.host.sendAndWait(failureOp);
    assertFalse("op failure should NOT call success handler", isSuccessHandlerCalled[0]);
    assertTrue("op failure should call success handler", isFailureHandlerCalled[0]);
}