/**
* when you must parse a 2xx status to determine if the operation succeeded or not.
*/
public void retryableExceptionInDecoder() throws IOException, InterruptedException {
MockWebServer server = new MockWebServer();
server.enqueue(new MockResponse().setBody("retry!".getBytes(UTF_8)));
server.enqueue(new MockResponse().setBody("success!".getBytes(UTF_8)));
server.play();
try {
TestInterface api = Feign.create(TestInterface.class, "http://localhost:" + server.getPort(),
new RetryableExceptionOnRetry());
assertEquals(api.post(), "success!");
} finally {
server.shutdown();
assertEquals(server.getRequestCount(), 2);
}
}