         let code = processHTTP(buffer, bufferLen: bufferLen)
         switch code {
         case 0:
+            isConnecting = false
             connected = true
             guard canDispatch else {return}
             callbackQueue.async { [weak self] in

    private func doDisconnect(_ error: NSError?) {
        guard !didDisconnect else { return }
        didDisconnect = true
        connected = false
        guard canDispatch else {return}
        callbackQueue.async { [weak self] in

        didDisconnect = false
        isConnecting = true
        createHTTPRequest()
    }

    /**
