@Test public void requestThrowingResponse() throws Exception { OkHttpResource r = buildResource(); ResourceOptions options = buildOptions(); Subscription subscription = buildSubscription(); String raw = json.toJson(subscription); server.enqueue(new MockResponse().setResponseCode(200) .setBody(raw) .setHeader("Content-Type", "application/json")); Subscription get = r.requestThrowing("GET", baseUrl() + "/subscriptions/thingies", options, Subscription.class); assertEquals(subscription, get); }
@Override public Response requestThrowing(String method, String url, ResourceOptions options) throws NakadiException { return maybeComposeRetryPolicy( Observable.defer( () -> Observable.just(requestThrowingInner(method, url, options)))).blockingFirst(); }
OkHttpResource implements Resource { @Override public Response requestThrowing(String method, String url, ResourceOptions options) throws NakadiException { return maybeComposeRetryPolicy( Observable.defer( () -> Observable.just(requestThrowingInner(method, url, options)))).blockingFirst(); } }
OkHttpResource implements Resource { @Override public Response requestThrowing(String method, String url, ResourceOptions options) throws NakadiException { return maybeComposeRetryPolicy( Observable.defer( () -> Observable.just(requestThrowingInner(method, url, options)))).blockingFirst(); } OkHttpResource(OkHttpClient okHttpClient, JsonSupport jsonSupport, MetricCollector collector); }
OkHttpResource implements Resource { @Override public Response requestThrowing(String method, String url, ResourceOptions options) throws NakadiException { return maybeComposeRetryPolicy( Observable.defer( () -> Observable.just(requestThrowingInner(method, url, options)))).blockingFirst(); } OkHttpResource(OkHttpClient okHttpClient, JsonSupport jsonSupport, MetricCollector collector); OkHttpResource connectTimeout(long timeout, TimeUnit unit); OkHttpResource readTimeout(long timeout, TimeUnit unit); @Override Resource writeTimeout(long timeout, TimeUnit unit); OkHttpResource retryPolicy(RetryPolicy retryPolicy); @Override Response request(String method, String url, ResourceOptions options); @Override Response requestThrowing(String method, String url, ResourceOptions options); @Override Response requestThrowing(String method, String url, ResourceOptions options,
      ContentSupplier body); @Override Response postEventsThrowing(String url, ResourceOptions options, ContentSupplier body); @Override Res requestThrowing(String method, String url, ResourceOptions options,
      Class<Res> res); @Override Res requestThrowing(String method, String url, ResourceOptions options,
      ContentSupplier body, Class<Res> res); }
OkHttpResource implements Resource { @Override public Response requestThrowing(String method, String url, ResourceOptions options) throws NakadiException { return maybeComposeRetryPolicy( Observable.defer( () -> Observable.just(requestThrowingInner(method, url, options)))).blockingFirst(); } OkHttpResource(OkHttpClient okHttpClient, JsonSupport jsonSupport, MetricCollector collector); OkHttpResource connectTimeout(long timeout, TimeUnit unit); OkHttpResource readTimeout(long timeout, TimeUnit unit); @Override Resource writeTimeout(long timeout, TimeUnit unit); OkHttpResource retryPolicy(RetryPolicy retryPolicy); @Override Response request(String method, String url, ResourceOptions options); @Override Response requestThrowing(String method, String url, ResourceOptions options); @Override Response requestThrowing(String method, String url, ResourceOptions options,
      ContentSupplier body); @Override Response postEventsThrowing(String url, ResourceOptions options, ContentSupplier body); @Override Res requestThrowing(String method, String url, ResourceOptions options,
      Class<Res> res); @Override Res requestThrowing(String method, String url, ResourceOptions options,
      ContentSupplier body, Class<Res> res);  }