         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

        Theo_000_BoltClientTests.runCount = Theo_000_BoltClientTests.runCount + 1
    }

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

        let result = client.connectSync()
        switch result {
        case let .failure(error):
            XCTFail("Failed connecting with error: \(error)")
        case let .success(isSuccess):
            XCTAssertTrue(isSuccess)
        }
        completionBlock?()
    }



    }

    func testCancellingTransaction() throws {
        measure {
            do {
                let client = try self.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)
                })
            } catch { XCTFail() }
        }
    }

    func testTransactionResultsInBookmark() throws {
