SubscribeOn main thread
<p>How can I set the async operator of Observable to run in the main thread instead in another thread. Or at least set to get the result in the main thread once we finish.</p>

<pre><code>    @Test
    public void retryWhen() {
        Scheduler scheduler = Schedulers.newThread();
        Single.just("single")
                .map(word -&gt; null)
                .map(Object::toString)
                .retryWhen(ot -&gt;
                        ot.doOnNext(t -&gt; System.out.println("Retry mechanism:" + t))
                                .filter(t -&gt; t instanceof NullPointerException &amp;&amp; cont &lt; 5)
                                .flatMap(t -&gt; Observable.timer(100, TimeUnit.MILLISECONDS,scheduler))
                                .doOnNext(t -&gt; cont++)
                                .switchIfEmpty(Observable.error(new NullPointerException())))
                .subscribeOn(scheduler)
                .subscribe(System.out::println, System.out::println);
//        new TestSubscriber()
//                .awaitTerminalEvent(1000, TimeUnit.MILLISECONDS);
    }
</code></pre>

<p>I´m trying observerOn and subscribeOn but both are used to set in which thread you want the execution. But in my case I want the execution or the end of it in the same thread where I run the test</p>

<p>Right now the only way to see the prints are just blocking and waiting for the execution.</p>

<p>Regards.</p>