Java 类org.apache.http.impl.client.DefaultRequestDirector 实例源码

项目:SoundcloudAPI    文件:ApiWrapper.java   
/** 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);
}
项目:paperchains    文件:ApiWrapper.java   
/** 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);
}
项目:FullRobolectricTestSample    文件:ShadowDefaultRequestDirector.java   
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);
}
项目:FullRobolectricTestSample    文件:DefaultRequestDirectorTest.java   
@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);
}
项目:FullRobolectricTestSample    文件:DefaultRequestDirectorTest.java   
@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);
}
项目:FullRobolectricTestSample    文件:RobolectricTest.java   
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);
}
项目:SecureShareLib    文件:ApiWrapper.java   
/** 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);
}
项目:FullRobolectricTestSample    文件:ShadowDefaultRequestDirector.java   
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);
  }
}
项目:FullRobolectricTestSample    文件:Robolectric.java   
public static ShadowDefaultRequestDirector shadowOf(DefaultRequestDirector instance) {
  return (ShadowDefaultRequestDirector) shadowOf_(instance);
}