OAuth1aInterceptor implements Interceptor { @Override public Response intercept(Chain chain) throws IOException { final Request request = chain.request(); final Request hackRequest = request.newBuilder() .url(urlWorkaround(request.url())) .build(); final Request newRequest = hackRequest .newBuilder() .header(OAuthConstants.HEADER_AUTHORIZATION, getAuthorizationHeader(hackRequest)) .build(); return chain.proceed(newRequest); } OAuth1aInterceptor(Session<? extends TwitterAuthToken> session,
            TwitterAuthConfig authConfig); @Override Response intercept(Chain chain);  }
@Test public void testIntercept() throws Exception { final Request request = new Request.Builder() .url(TEST_URL) .header(TEST_HEADER, TEST_HEADER) .build(); when(mockChain.request()).thenReturn(request); interceptor.intercept(mockChain); verify(mockChain).proceed(requestCaptor.capture()); final Request signedRequest = requestCaptor.getValue(); assertNotNull(signedRequest.header(OAuthConstants.HEADER_AUTHORIZATION)); assertEquals(TEST_HEADER, signedRequest.header(TEST_HEADER)); }