}
}
@Test(dataProvider = "levelToReadTimeoutOutput")
public void readTimeoutEmits(final Logger.Level logLevel, List<String> expectedMessages) throws IOException, InterruptedException {
final MockWebServer server = new MockWebServer();
server.enqueue(new MockResponse().setBytesPerSecond(1).setBody("foo"));
server.play();
try {
SendsStuff api = Feign.create(SendsStuff.class, "http://localhost:" + server.getUrl("").getPort(),
new LessReadTimeoutModule(), new DefaultModule(logger, logLevel));
api.login("netflix", "denominator", "password");
fail();
} catch (FeignException e) {
assertMessagesMatch(expectedMessages);
assertEquals(new String(server.takeRequest().getBody(), UTF_8),
"{\"customer_name\": \"netflix\", \"user_name\": \"denominator\", \"password\": \"password\"}");
} finally {
server.shutdown();
}
}