use of okhttp3.Protocol.HTTP_2 in project okhttp by square.
the class LoggingEventListenerTest method testCacheEvents.
@Test
public void testCacheEvents() {
Request request = new Request.Builder().url(url).build();
Call call = client.newCall(request);
Response response = new Response.Builder().request(request).code(200).message("").protocol(HTTP_2).build();
EventListener listener = loggingEventListenerFactory.create(call);
listener.cacheConditionalHit(call, response);
listener.cacheHit(call, response);
listener.cacheMiss(call);
listener.satisfactionFailure(call, response);
logRecorder.assertLogMatch("cacheConditionalHit: Response\\{protocol=h2, code=200, message=, url=" + url + "\\}").assertLogMatch("cacheHit: Response\\{protocol=h2, code=200, message=, url=" + url + "\\}").assertLogMatch("cacheMiss").assertLogMatch("satisfactionFailure: Response\\{protocol=h2, code=200, message=, url=" + url + "\\}").assertNoMoreLogs();
}
Aggregations