         if Theo_000_BoltClientTests.runCount % 2 == 0 {
             let group = DispatchGroup()
             group.enter()
-            performConnect(client: client) { result in
-                XCTAssertTrue(result)
+            performConnect(client: client) { connectionSuccessful in
+                XCTAssertTrue(connectionSuccessful)
                 group.leave()
             }
             group.wait()
         } else {
-            performConnectSync(client: client)
+            performConnectSync(client: client) { connectionSuccessful in
+                XCTAssertTrue(connectionSuccessful)
+            }
         }
 
         return client

    }

    func testCancellingTransaction() throws {
        let client = try makeClient()
        let exp = self.expectation(description: "testCancellingTransaction")

        try client.executeAsTransaction() { (tx) in
            tx.markAsFailed()
            exp.fulfill()
        }

        self.waitForExpectations(timeout: TheoTimeoutInterval, handler: { error in
            XCTAssertNil(error)
        })

    }

    func testTransactionResultsInBookmark() throws {

        Theo_000_BoltClientTests.runCount = Theo_000_BoltClientTests.runCount + 1
    }

    private func performConnectSync(client: BoltClient, completionBlock: ((Bool) -> ())? = nil) {

        let result = client.connectSync()
        switch result {
        case let .failure(error):
            if let theError = error.error as? Socket.Error,
                theError.errorCode == -9806 { // retry aborted connection
                client.disconnect()
                performConnectSync(client: client, completionBlock: completionBlock)
            } else {
                XCTFail("Failed connecting with error: \(error)")
                completionBlock?(false)
            }
        case let .success(isSuccess):
            XCTAssertTrue(isSuccess)
            completionBlock?(true)
        }
    }


