 
                     let error = NSError(domain: "com.autosoftdms.SignalR-Swift.\(type(of: self))", code: 0, userInfo: userInfo)
 
-                    if let handler = completionHandler {
-                        handler(nil, error)
-                    }
+                    completionHandler?(nil, error)
                 }
             } else {
-                self.transport = transport
+                strongRef.transport = transport
 
-                if let handler = completionHandler {
-                    handler(nil, nil)
-                }
+                completionHandler?(nil, error)
             }
         }
     }

    // MARK: - Client Transport Protocol

    override public var name: String? {
        if self.transport == nil {
            return nil
        }

        return self.transport?.name
    }

    override public var supportsKeepAlive: Bool {
        if let transport = self.transport {
            return transport.supportsKeepAlive
        }

        return false
    }

    override public func negotiate(connection: ConnectionProtocol, connectionData: String?, completionHandler: ((NegotiationResponse?, Error?) -> ())?) {
        super.negotiate(connection: connection, connectionData: connectionData) { [unowned self] (response, error) in

            if error == nil {
                if let tryWebSockets = response?.tryWebSockets, !tryWebSockets {
                    if let invalidIndex = self.transports.index(where: { (element) -> Bool in
                        element.name == "webSockets" 
                    }) {
                        self.transports.remove(at: invalidIndex)
                    }
                }
            }

            if let handler = completionHandler {
                handler(response, error)
            }
        }
    }



    func start(connection: ConnectionProtocol, connectionData: String?, transportIndex index: Int, completionHandler: ((String?, Error?) -> ())?) {
        let transport = self.transports[index]
        transport.start(connection: connection, connectionData: connectionData) { [weak self] (response, error) in
            guard let strongRef = self else { return }

            if error != nil {
                let nextIndex = index + 1

                if nextIndex < strongRef.transports.count {
                    strongRef.start(connection: connection, connectionData: connectionData, transportIndex: nextIndex, completionHandler: completionHandler)
                } else {
                    let userInfo = [
                        NSLocalizedFailureReasonErrorKey: NSExceptionName.internalInconsistencyException.rawValue,
