 
         self.readyState = EventSourceState.connecting
         self.urlSession = newSession(configuration)
-        self.task = urlSession!.dataTask(with: self.url);
-
+        self.task = urlSession!.dataTask(with: self.url)
+
+        self.resumeSession()
+    }
+
+    internal func resumeSession() {
         self.task!.resume()
     }
 
     internal func newSession(_ configuration: URLSessionConfiguration) -> Foundation.URLSession {
-        return Foundation.URLSession(configuration: configuration, delegate: self, delegateQueue: operationQueue)
+        return Foundation.URLSession(configuration: configuration,
+                                     delegate: self,
+                                     delegateQueue: operationQueue)
     }
 
     //Mark: Close

        let separators = CharacterSet(charactersIn: ":")
        if let milli = eventString.components(separatedBy: separators).last {
            let milliseconds = trim(milli)

            if let intMiliseconds = Int(milliseconds) {
                reconnectTime = intMiliseconds
            }

        if self.readyState != EventSourceState.open {
            return
        }

        self.receivedDataBuffer.append(data)
        let eventStream = extractEventsFromBuffer()
        self.parseEventStream(eventStream)
    }

    open func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse, completionHandler: @escaping (URLSession.ResponseDisposition) -> Void) {
        completionHandler(URLSession.ResponseDisposition.allow)

        if self.receivedMessageToClose(dataTask.response as? HTTPURLResponse) {
            return
        }

        self.readyState = EventSourceState.open
        if self.onOpenCallback != nil {
            DispatchQueue.main.async {
                self.onOpenCallback!()
            }
