 
     private func failOpenWithError(error: Error, changeState: Bool, leaveStartDispatchGroup: Bool = true) {
         if changeState {
-            _ = self.changeState(from: nil, to: State.stopped)
+            _ = self.changeState(from: nil, to: .stopped)
         }
 
         if leaveStartDispatchGroup {

    public func stop(stopError: Error? = nil) {
        logger.log(logLevel: .info, message: "Stopping connection")

        let previousState = self.changeState(from: nil, to: State.stopped)
        if previousState == State.stopped {
            logger.log(logLevel: .info, message: "Connection already stopped")
            return
        }

        if previousState == State.initial {
            logger.log(logLevel: .warning, message: "Connection not yet started")
            return
        }

        self.url = url
        self.options = options
        self.logger = logger
        self.state = .initial
        self.transportDelegate = ConnectionTransportDelegate(connection: self)
    }

    public func start(transport: Transport? = nil) {
        logger.log(logLevel: .info, message: "Starting connection")

        if changeState(from: .initial, to: .connecting) == nil {
            logger.log(logLevel: .error, message: "Starting connection failed - invalid state")
            // the connection is already in use so the startDispatchGroup should not be touched to not affect it
            failOpenWithError(error: SignalRError.invalidState, changeState: false, leaveStartDispatchGroup: false)
