         }
         return (try? NSJSONSerialization.JSONObjectWithData(data, options: [])) as? [String : AnyObject]
     }
-    
+
     private func validateAdvertisingUpdate(jsonString: String, advertising: Bool, browsing: Bool) {
         let json = jsonDicitonaryFrom(jsonString)
         let listeningActive = (json?["discoveryActive"] as? Bool)

        XCTAssertNil(error)
        var contextError: AppContextError?
        do {
            try context.didRegisterToNative([42])
        } catch let err as AppContextError{
            contextError = err
        } catch _ {

    func testListeningAdvertisingUpdateOnStartAdvertising() {
        let delegateMock = AppContextDelegateMock()
        context.delegate = delegateMock
        let port = 42
        let _ = try? context.startUpdateAdvertisingAndListening(withParameters: [port])
        validateAdvertisingUpdate(delegateMock.advertisingListeningState, advertising: true,
                                  browsing: false)
    }
