     private func startStopHTTPServerIfNeeded(subscriptions: [String: Subscription]) {
         let httpServer = self._httpServer
         if subscriptions.count == 0 && httpServer.running {
-            httpServer.stop()
+            if !stopHTTPServer() {
+                LogError("Error stopping HTTP server")
+            }
         }
         else if subscriptions.count > 0 && !httpServer.running {
-            var error: NSError?
-            if !httpServer.startWithPort(_httpServerPort, bonjourName: nil) {
-                let toAppend = error != nil && error?.localizedDescriptionOrNil != nil ? ": \(error!.localizedDescription)" : ""
-                LogError("Error starting HTTP server" + toAppend)
+            if !startHTTPServer() {
+                LogError("Error starting HTTP server")
             }
         }
     }

                LogError("\(errorDescription)")
            }
        })
    }
}


        dispatch_barrier_async(self._concurrentSubscriptionQueue, { () -> Void in
            // needs to be running in order to get server url for the subscription message
            let httpServer = self._httpServer
            var serverURL: NSURL? = httpServer.serverURL
            
            // most likely nil if the http server is stopped
            if serverURL == nil && !httpServer.running {
                // Start http server
                if self.startHTTPServer() {
                    // Grab server url
                    serverURL = httpServer.serverURL
                    
                    // Stop http server if it's not needed further
                    self.startStopHTTPServerIfNeeded(self._subscriptions)
                }
                else {
                    LogError("Error starting HTTP server")
                }
            }
            
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), { () -> Void in
                serverURL != nil ? closure(eventCallBackURL: NSURL(string: self._eventCallBackPath, relativeToURL: serverURL)!) : closure(eventCallBackURL: nil)
