use of okhttp3.TestLogHandler in project okhttp by square.
the class WebSocketHttpTest method throwingOnFailLogs.
@Ignore("AsyncCall currently lets runtime exceptions propagate.")
@Test
public void throwingOnFailLogs() throws InterruptedException {
TestLogHandler logs = new TestLogHandler();
Logger logger = Logger.getLogger(OkHttpClient.class.getName());
logger.addHandler(logs);
webServer.enqueue(new MockResponse().setResponseCode(200).setBody("Body"));
final RuntimeException e = new RuntimeException();
clientListener.setNextEventDelegate(new WebSocketListener() {
@Override
public void onFailure(WebSocket webSocket, Throwable t, Response response) {
throw e;
}
});
newWebSocket();
assertEquals("", logs.take());
logger.removeHandler(logs);
}
Aggregations