retrofit/src/test/java/retrofit/RxSupportTest.java
@Override public ResponseWrapper invoke(RequestInterceptor requestInterceptor) {
  private RequestInterceptor requestInterceptor = spy(new RequestInterceptor() {
    @Override public void intercept(RequestFacade request) {
new Invoker()
retrofit/src/test/java/retrofit/RxSupportTest.java
rxSupport.createRequestObservable(invoker).subscribe(subscriber);
  @Test public void observableCallsOnNextOnHttpExecutorWithSubscriber() {
    rxSupport.createRequestObservable(invoker).subscribeOn(test).subscribe(subscriber);
  @Test public void observableUnSubscribesDoesNotExecuteCallable() throws Exception {
    Subscription subscription = rxSupport.createRequestObservable(invoker).subscribe(subscriber);
    verify(invoker, never()).invoke(any(RequestInterceptor.class));
  @Test public void observableCallsOperatorsOffHttpExecutor() {
    rxSupport.createRequestObservable(invoker)
  @Test public void observableDoesNotLockExecutor() {
    rxSupport.createRequestObservable(invoker)
    rxSupport.createRequestObservable(invoker)
  @Test public void observableRespectsObserveOn() throws Exception {
    rxSupport.createRequestObservable(invoker)
    verify(invoker, times(1)).invoke(any(RequestInterceptor.class));
  @Test public void observableCallsInterceptorForEverySubscription() throws Exception {
    rxSupport.createRequestObservable(invoker).subscribe(subscriber);
    rxSupport.createRequestObservable(invoker).subscribe(subscriber);

    // The interceptor should have been called for each request upon subscription.
    verify(requestInterceptor, times(2)).intercept(any(RequestFacade.class));

    // Background execution of the requests should not touch the interceptor.
    executor.executeAll();
    verifyNoMoreInteractions(requestInterceptor);
void observableCallsOnNextOnHttpExecutor()
final Callable<ResponseWrapper> request
retrofit/src/main/java/retrofit/RxSupport.java
if (subscriber.isUnsubscribed()) {
          return;
Observable createRequestObservable(final Callable<ResponseWrapper> request)