 """          def cancel = GradleConnector.newCancellationTokenSource()         def sync = server.expectAndBlock("registered")         def resultHandler = new TestResultHandler()          when:         withConnection { ProjectConnection connection ->             def build = connection.newBuild()             build.forTasks(':sub:broken')             build.withCancellationToken(cancel.token())             collectOutputs(build)             build.run(resultHandler)             sync.waitForAllPendingCalls(resultHandler)             cancel.cancel()             sync.releaseAll()             resultHandler.finished()         }          then:         buildWasCancelled(resultHandler)     