Single<Response> execute(Request request) {
    Objects.requireNonNull(request, "request");
    return Single.create(source -> {
      restClient.performRequestAsync(request, new ResponseListener() {
        @Override
        public void onSuccess(Response response) {
          source.onSuccess(response);
        }

        @Override
        public void onFailure(Exception exception) {
          source.onError(exception);
        }
      });
    });
  }
Wrapper for {@link RestClient} which uses RxJava types
criteria/elasticsearch/src/org/immutables/criteria/elasticsearch/RxJavaTransport.java