use of feign.Target in project feign by OpenFeign.
the class Http2ClientAsyncTest method throwsFeignExceptionIncludingBody.
@Test
public void throwsFeignExceptionIncludingBody() throws Throwable {
server.enqueue(new MockResponse().setBody("success!"));
final TestInterfaceAsync api = newAsyncBuilder().decoder((response, type) -> {
throw new IOException("timeout");
}).target("http://localhost:" + server.getPort());
final CompletableFuture<?> cf = api.body("Request body");
server.takeRequest();
try {
unwrap(cf);
} catch (final FeignException e) {
Assertions.assertThat(e.getMessage()).isEqualTo("timeout reading POST http://localhost:" + server.getPort() + "/");
Assertions.assertThat(e.contentUTF8()).isEqualTo("Request body");
return;
}
fail();
}
use of feign.Target in project feign by OpenFeign.
the class Http2ClientAsyncTest method doesntRetryAfterResponseIsSent.
@Test
public void doesntRetryAfterResponseIsSent() throws Throwable {
server.enqueue(new MockResponse().setBody("success!"));
thrown.expect(FeignException.class);
thrown.expectMessage("timeout reading POST http://");
final TestInterfaceAsync api = newAsyncBuilder().decoder((response, type) -> {
throw new IOException("timeout");
}).target("http://localhost:" + server.getPort());
final CompletableFuture<?> cf = api.post();
server.takeRequest();
unwrap(cf);
}
Aggregations