title: Rxjava - How to retry call after doOnError completes
body: <p>I`m struggling to retry my rxjava Single call <strong>after</strong> another network call is done in doOnError:</p>
  
  <pre><code>restApi.getStuff()
         .subscribeOn(Schedulers.io())
         .observeOn(AndroidSchedulers.mainThread())
         .doOnError {
              getRefreshToken(it, AuthenticationManager.Callback{
                  retry(1)
              })
         }
         .subscribeBy(
               onSuccess = { response -&gt;},
               onError = { throwable -&gt;}
         )
  </code></pre>
  
  <p>But the retry method cannot be invoked inside the doOnError method.
  Do you have any other ideas?</p>