title: Observable.create inside generic Alamofire call function not working when calling validate()
body: <p>I want to make a validated network request using Alamofire, through a 'generic' function. 
  If I don't use RX at all or if I don't call validate() or anyCustomValidate() it works fine, but if I use it with the Observable.create and validate() as below, it does not work.
  This is what it does instead:</p>
  
  <pre><code>     1.makes tokenRefresh call
       2.receives the new token
       3.calls completion(true, 0.0) (as below)
  </code></pre>
  
  <p>but then nothing happens...</p>
  
  <p>Here is my generic function:</p>
  
  <pre><code>func sendRequest&lt;Response: Codable&gt;(endpoint: URLRequestConvertible) -&gt; Observable&lt;Response&gt; {
      return Observable&lt;Response&gt;.create { observer in
          let request = self.session.request(endpoint)
              .validate()
              .responseJSON { response in
                  print(response)
                  switch response.result {
                  case .success:
                      do {
                          let model = try JSONDecoder().decode(Response.self, from: response.data!)
                          observer.onNext(model)
                      } catch {
                          print("generic call function error: \(error)")
                          observer.onError(RequestError.failedParsingError(ErrTypes.somethingWrong.rawValue))
                      }
                  case .failure:
                  observer.onError(RequestError.failedParsingError(ErrTypes.somethingWrong.rawValue))
                  }
          }
          return Disposables.create {
              request.cancel()
          }
      }.observeOn(MainScheduler.instance)
  }
  </code></pre>
  
  <p>This is how I use it to get a specific response:</p>
  
  <pre><code>func getAddresses(clientId: Int) -&gt; Observable&lt;[AddressesResponse]&gt; {
      return sendRequest(endpoint: CustomerEndPoint.getAddresses(userID: clientId))
  }
  </code></pre>
  
  <p>And this is how I call the function:</p>
  
  <pre><code> @objc func buttonPressed() {
      getAddresses(clientId: 1111).subscribe(onNext: { addresses in
          print(addresses)
      }).disposed(by: disposeBag)
  }
  </code></pre>
  
  <p>This is my Request retrier:</p>
  
  <pre><code>extension AuthHandler: RequestRetrier {
  
  func should(_ manager: SessionManager, retry request: Request, with error: Error, completion: @escaping RequestRetryCompletion) {
      guard let request = request as? DataRequest, request.delegate.data != nil else { fatalError() }
      guard let headerStatusCode = request.response?.statusCode else {
          completion(false, 0.0)
          return
      }
      if headerStatusCode == 401 || headerStatusCode == 403 {
          refreshToken(success: {
              completion(true, 0.0)
          }, failure: { message in
              print(message)
          })
      } else {
          if let json = String(data: request.delegate.data!, encoding: String.Encoding.utf8),
          let jsonObject = dictionaryWithJSONString(json) as? [String:Any],
          let statusMessage = jsonObject["statusMessage"] as? [String: Any],
          let status = statusMessage["status"] as? Int {
              if status == 401 || status == 403 {
                  self.refreshToken(success: {
                      completion(true, 0.0)
                  }, failure: { message in
                      completion(false, 0.0)
                      print(message)
                  })
              }
          }
      }
  }
  </code></pre>
  
  <p>After a while this gets printed on the console log:</p>
  
  <pre><code>2019-02-17 22:25:13.368846+0100 AlamofireValidator[76262:1527976] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C1.1:2][0x7fc5cf50e020] get output frames failed, state 8196
  </code></pre>