/** This method mainly exists to make the wrapper more testable. oh, apache's insanity. */
protected RequestDirector getRequestDirector(HttpRequestExecutor requestExec,
ClientConnectionManager conman,
ConnectionReuseStrategy reustrat,
ConnectionKeepAliveStrategy kastrat,
HttpRoutePlanner rouplan,
HttpProcessor httpProcessor,
HttpRequestRetryHandler retryHandler,
RedirectHandler redirectHandler,
AuthenticationHandler targetAuthHandler,
AuthenticationHandler proxyAuthHandler,
UserTokenHandler stateHandler,
HttpParams params
) {
return new DefaultRequestDirector(requestExec, conman, reustrat, kastrat, rouplan,
httpProcessor, retryHandler, redirectHandler, targetAuthHandler, proxyAuthHandler,
stateHandler, params);
}
java类org.apache.http.impl.client.DefaultRequestDirector的实例源码
ApiWrapper.java 文件源码
项目:SoundcloudAPI
阅读 23
收藏 0
点赞 0
评论 0
ApiWrapper.java 文件源码
项目:paperchains
阅读 26
收藏 0
点赞 0
评论 0
/** This method mainly exists to make the wrapper more testable. oh, apache's insanity. */
protected RequestDirector getRequestDirector(HttpRequestExecutor requestExec,
ClientConnectionManager conman,
ConnectionReuseStrategy reustrat,
ConnectionKeepAliveStrategy kastrat,
HttpRoutePlanner rouplan,
HttpProcessor httpProcessor,
HttpRequestRetryHandler retryHandler,
RedirectHandler redirectHandler,
AuthenticationHandler targetAuthHandler,
AuthenticationHandler proxyAuthHandler,
UserTokenHandler stateHandler,
HttpParams params
) {
return new DefaultRequestDirector(requestExec, conman, reustrat, kastrat, rouplan,
httpProcessor, retryHandler, redirectHandler, targetAuthHandler, proxyAuthHandler,
stateHandler, params);
}
ShadowDefaultRequestDirector.java 文件源码
项目:FullRobolectricTestSample
阅读 22
收藏 0
点赞 0
评论 0
public void __constructor__(
HttpRequestExecutor requestExec,
ClientConnectionManager conman,
ConnectionReuseStrategy reustrat,
ConnectionKeepAliveStrategy kastrat,
HttpRoutePlanner rouplan,
HttpProcessor httpProcessor,
HttpRequestRetryHandler retryHandler,
RedirectHandler redirectHandler,
AuthenticationHandler targetAuthHandler,
AuthenticationHandler proxyAuthHandler,
UserTokenHandler userTokenHandler,
HttpParams params) {
__constructor__(
LogFactory.getLog(DefaultRequestDirector.class),
requestExec,
conman,
reustrat,
kastrat,
rouplan,
httpProcessor,
retryHandler,
redirectHandler,
targetAuthHandler,
proxyAuthHandler,
userTokenHandler,
params);
}
DefaultRequestDirectorTest.java 文件源码
项目:FullRobolectricTestSample
阅读 21
收藏 0
点赞 0
评论 0
@Before
public void setUp_EnsureStaticStateIsReset() {
FakeHttpLayer fakeHttpLayer = Robolectric.getFakeHttpLayer();
assertFalse(fakeHttpLayer.hasPendingResponses());
assertFalse(fakeHttpLayer.hasRequestInfos());
assertFalse(fakeHttpLayer.hasResponseRules());
assertNull(fakeHttpLayer.getDefaultResponse());
connectionKeepAliveStrategy = new ConnectionKeepAliveStrategy() {
@Override public long getKeepAliveDuration(HttpResponse httpResponse, HttpContext httpContext) {
return 0;
}
};
requestDirector = new DefaultRequestDirector(null, null, null, connectionKeepAliveStrategy, null, null, null, null, null, null, null, null);
}
DefaultRequestDirectorTest.java 文件源码
项目:FullRobolectricTestSample
阅读 29
收藏 0
点赞 0
评论 0
@Test
public void shouldRecordExtendedRequestData() throws Exception {
Robolectric.addPendingHttpResponse(200, "a happy response body");
HttpGet httpGet = new HttpGet("http://example.com");
requestDirector.execute(null, httpGet, null);
assertSame(Robolectric.getSentHttpRequestInfo(0).getHttpRequest(), httpGet);
ConnectionKeepAliveStrategy strategy = shadowOf((DefaultRequestDirector) Robolectric.getSentHttpRequestInfo(0).getRequestDirector()).getConnectionKeepAliveStrategy();
assertSame(strategy, connectionKeepAliveStrategy);
}
RobolectricTest.java 文件源码
项目:FullRobolectricTestSample
阅读 20
收藏 0
点赞 0
评论 0
private void makeRequest(String uri) throws HttpException, IOException {
Robolectric.addPendingHttpResponse(200, "a happy response body");
ConnectionKeepAliveStrategy connectionKeepAliveStrategy = new ConnectionKeepAliveStrategy() {
@Override
public long getKeepAliveDuration(HttpResponse httpResponse, HttpContext httpContext) {
return 0;
}
};
DefaultRequestDirector requestDirector = new DefaultRequestDirector(null, null, null, connectionKeepAliveStrategy, null, null, null, null, null, null, null, null);
requestDirector.execute(null, new HttpGet(uri), null);
}
ApiWrapper.java 文件源码
项目:SecureShareLib
阅读 19
收藏 0
点赞 0
评论 0
/** This method mainly exists to make the wrapper more testable. oh, apache's insanity. */
protected RequestDirector getRequestDirector(HttpRequestExecutor requestExec,
ClientConnectionManager conman,
ConnectionReuseStrategy reustrat,
ConnectionKeepAliveStrategy kastrat,
HttpRoutePlanner rouplan,
HttpProcessor httpProcessor,
HttpRequestRetryHandler retryHandler,
RedirectHandler redirectHandler,
AuthenticationHandler targetAuthHandler,
AuthenticationHandler proxyAuthHandler,
UserTokenHandler stateHandler,
HttpParams params
) {
return new DefaultRequestDirector(requestExec, conman, reustrat, kastrat, rouplan,
httpProcessor, retryHandler, redirectHandler, targetAuthHandler, proxyAuthHandler,
stateHandler, params);
}
ShadowDefaultRequestDirector.java 文件源码
项目:FullRobolectricTestSample
阅读 21
收藏 0
点赞 0
评论 0
public void __constructor__(
Log log,
HttpRequestExecutor requestExec,
ClientConnectionManager conman,
ConnectionReuseStrategy reustrat,
ConnectionKeepAliveStrategy kastrat,
HttpRoutePlanner rouplan,
HttpProcessor httpProcessor,
HttpRequestRetryHandler retryHandler,
RedirectHandler redirectHandler,
AuthenticationHandler targetAuthHandler,
AuthenticationHandler proxyAuthHandler,
UserTokenHandler userTokenHandler,
HttpParams params) {
this.log = log;
this.httpRequestExecutor = requestExec;
this.connectionManager = conman;
this.connectionReuseStrategy = reustrat;
this.connectionKeepAliveStrategy = kastrat;
this.httpRoutePlanner = rouplan;
this.httpProcessor = httpProcessor;
this.httpRequestRetryHandler = retryHandler;
this.redirectHandler = redirectHandler;
this.targetAuthenticationHandler = targetAuthHandler;
this.proxyAuthenticationHandler = proxyAuthHandler;
this.userTokenHandler = userTokenHandler;
this.httpParams = params;
try {
redirector = new org.robolectric.tester.org.apache.http.impl.client.DefaultRequestDirector(
log,
requestExec,
conman,
reustrat,
kastrat,
rouplan,
httpProcessor,
retryHandler,
redirectHandler,
targetAuthHandler,
proxyAuthHandler,
userTokenHandler,
params
);
} catch (IllegalArgumentException ignored) {
Robolectric.getFakeHttpLayer().interceptHttpRequests(true);
}
}
Robolectric.java 文件源码
项目:FullRobolectricTestSample
阅读 28
收藏 0
点赞 0
评论 0
public static ShadowDefaultRequestDirector shadowOf(DefaultRequestDirector instance) {
return (ShadowDefaultRequestDirector) shadowOf_(instance);
}