GuestAuthenticator implements Authenticator { Request reauth(Response response) { if (canRetry(response)) { final GuestSession session = guestSessionProvider .refreshCurrentSession(getExpiredSession(response)); final GuestAuthToken token = session == null ? null : session.getAuthToken(); if (token != null) { return resign(response.request(), token); } } return null; } GuestAuthenticator(GuestSessionProvider guestSessionProvider); @Override Request authenticate(Route route, Response response);  }
@Test public void testReauth_emptyHeaders() { request = new Request.Builder() .url(TEST_URL) .build(); response = new Response.Builder() .code(401) .message("Unauthorized") .protocol(Protocol.HTTP_1_1) .request(request) .build(); final Request request = authenticator.reauth(response); assertNull(request); }