     
     func jsonResponseHandler(expectation expectation: XCTestExpectation) -> (AnyObject) -> ServiceTaskResult {
         return { json in
+            XCTAssertTrue(!NSThread.isMainThread())
+
             if json is NSDictionary {
                 expectation.fulfill()
             }

                return ServiceTaskResult.Empty
            }
            .responseError { error in
                XCTAssertFalse(wasResponseCalled, "Response should not be called for error cases")
                errorExpectation.fulfill()
            }

    
    func responseHandler(expectation expectation: XCTestExpectation) -> (NSData?, NSURLResponse?) -> ServiceTaskResult {
        return { data, response in
            XCTAssertTrue(!NSThread.isMainThread())

            let httpResponse = response as! NSHTTPURLResponse
            
            if httpResponse.statusCode == 200 {
