   private var thread: Thread?
   private let queue: DispatchQueue
 
-  private var stopped = true
   private var singles: [UInt32: SingleResponseObserver] = [:]
 
   private let streamSubject = PublishSubject<Message>()

          self.queue.async { self.cleanUpAndCloseSocket() }
          return
        }
      } while !self.queue.sync { self.stopped }
    }

    self.thread?.start()

          return
        }

        if !expectsReturnValue { single(.success(self.nilResponse(with: msgid))) }
      }

      return Disposables.create()
