import XCTest
@testable import Phakchi

class ControlServiceClientTestCase: XCTestCase {
    var controlServiceClient: ControlServiceClient!

    override func setUp() {
        super.setUp()
        self.controlServiceClient = ControlServiceClient()
    }

    func testStart() {
        var session: Session!
        let expectationToStart = expectation(description: "session was started")
        let controlServiceClient = ControlServiceClient()
        controlServiceClient.start(session: "consumer name",
                                   providerName: "provider name") { (newSession) in
                                    session = newSession
                                    XCTAssertEqual(session.consumerName, "consumer name")
                                    XCTAssertEqual(session.providerName, "provider name")
                                    XCTAssertNotNil(session)
                                    expectationToStart.fulfill()
        }
        waitForExpectations(timeout: 15.0, handler: nil)
    }
    
}

import XCTest
@testable import Phakchi

class ControlServiceClientTestCase: XCTestCase {
    var controlServiceClient: ControlServiceClient!

    override func setUp() {
        super.setUp()
        self.controlServiceClient = ControlServiceClient()
    }

    func testStart() {
        var session: Session!
        let exp = expectation(description: "session was started")
        let controlServiceClient = ControlServiceClient()
        controlServiceClient.start(session: "consumer name",
                                   providerName: "provider name") { (newSession) in
                                    session = newSession
                                    XCTAssertEqual(session.consumerName, "consumer name")
                                    XCTAssertEqual(session.providerName, "provider name")
                                    XCTAssertNotNil(session)
                                    exp.fulfill()
        }
        waitForExpectations(timeout: 5.0, handler: nil)
    }
    
}

--- 
+++ 
@@ -11,7 +11,7 @@
 
     func testStart() {
         var session: Session!
-        let exp = expectation(description: "session was started")
+        let expectationToStart = expectation(description: "session was started")
         let controlServiceClient = ControlServiceClient()
         controlServiceClient.start(session: "consumer name",
                                    providerName: "provider name") { (newSession) in
@@ -19,9 +19,9 @@
                                     XCTAssertEqual(session.consumerName, "consumer name")
                                     XCTAssertEqual(session.providerName, "provider name")
                                     XCTAssertNotNil(session)
-                                    exp.fulfill()
+                                    expectationToStart.fulfill()
         }
-        waitForExpectations(timeout: 5.0, handler: nil)
+        waitForExpectations(timeout: 15.0, handler: nil)
     }
     
 }
Add long delay when starting session
