Looking at the test, I think it can still fail. Because the task is started asynchronously, it's possible for it to be cancelled before it even starts executing. You should use a latch to ensure that `future.cancel()` is only called when the task is running.