Examples of ClientConnectionManager


Examples of org.apache.http.conn.ClientConnectionManager

                }
            } finally {

                boxClient.setConnectionOpen(false);
                // close connections in the underlying HttpClient
                @SuppressWarnings("deprecation")
                final ClientConnectionManager connectionManager = cachedBoxClient.getClientConnectionManager();
                if (connectionManager != null) {
                    LOG.debug("Closing connections for {}", cachedBoxClient);

                    connectionManager.shutdown();
                } else {
                    LOG.debug("ConnectionManager not created for {}", cachedBoxClient);
                }
            }
            LOG.debug("Shutdown successful for {}", cachedBoxClient);
View Full Code Here

Examples of org.apache.http.conn.ClientConnectionManager

   * Help method to create a base TestWSClient.
   */
  private TestWSPostAuthenticatedClient getTestWSClient(List<NameValuePair> params,
      String responseURI) throws IOException {
    HttpClient httpClient = Mockito.mock(HttpClient.class);
    ClientConnectionManager connectionManager = Mockito.mock(
        ClientConnectionManager.class);
    when(httpClient.getConnectionManager()).thenReturn(connectionManager);

    StatusLine statusLine = Mockito.mock(StatusLine.class);
    when(statusLine.getStatusCode()).thenReturn(200);
View Full Code Here

Examples of org.apache.http.conn.ClientConnectionManager

 
  @SuppressWarnings("unchecked")
  private ArtistTopTagsClient getArtistTopTagsClient(WebserviceHistoryService historyService) throws IOException {
    // create a HTTP client that always returns Cher top tracks
    HttpClient httpClient = mock(HttpClient.class);
    ClientConnectionManager connectionManager = mock(ClientConnectionManager.class);
    when(httpClient.getConnectionManager()).thenReturn(connectionManager);
    String httpResponse = new ResourceUtil(CHER_TOP_TAGS).getContent();
    when(httpClient.execute(Mockito.any(HttpUriRequest.class),
        Mockito.any(ResponseHandler.class))).thenReturn(httpResponse);
View Full Code Here

Examples of org.apache.http.conn.ClientConnectionManager

  /*
   * Help method to create a base TestWSClient.
   */
  private TestWSGetClient getTestWSClient(boolean allowCalls) {
    HttpClient httpClient = Mockito.mock(HttpClient.class);
    ClientConnectionManager connectionManager = Mockito.mock(
        ClientConnectionManager.class);
    when(httpClient.getConnectionManager()).thenReturn(connectionManager);
   
    WebserviceHistoryService historyService = mock(WebserviceHistoryService.class);
    when(historyService.isWebserviceInvocationAllowed(
View Full Code Here

Examples of org.apache.http.conn.ClientConnectionManager

 
  @SuppressWarnings("unchecked")
  private ArtistSimilarityClient getArtistSimilarityClient(WebserviceHistoryService historyService) throws IOException {
    // create a HTTP client that always returns Cher artist relations
    HttpClient httpClient = mock(HttpClient.class);
    ClientConnectionManager connectionManager = mock(ClientConnectionManager.class);
    when(httpClient.getConnectionManager()).thenReturn(connectionManager);
    String httpResponse = new ResourceUtil(CHER_ARTIST_RELATIONS).getContent();
    when(httpClient.execute(Mockito.any(HttpUriRequest.class),
        Mockito.any(ResponseHandler.class))).thenReturn(httpResponse);
   
View Full Code Here

Examples of org.apache.http.conn.ClientConnectionManager

    when(historyService.isWebserviceInvocationAllowed(
        Mockito.any(WebserviceInvocation.class))).thenReturn(true);

    // create a HTTP client that always returns sampled scrobbled tracks from last.fm
    HttpClient httpClient = mock(HttpClient.class);
    ClientConnectionManager connectionManager = mock(ClientConnectionManager.class);
    when(httpClient.getConnectionManager()).thenReturn(connectionManager);
    String httpResponse = new ResourceUtil(SCROBBLED_TRACKS).getContent();
    when(httpClient.execute(Mockito.any(HttpUriRequest.class),
        Mockito.any(ResponseHandler.class))).thenReturn(httpResponse);
View Full Code Here

Examples of org.apache.http.conn.ClientConnectionManager

 
  @SuppressWarnings("unchecked")
  private ArtistTopTracksClient getArtistTopTracksClient(WebserviceHistoryService historyService) throws IOException {
    // create a HTTP client that always returns Cher top tracks
    HttpClient httpClient = mock(HttpClient.class);
    ClientConnectionManager connectionManager = mock(ClientConnectionManager.class);
    when(httpClient.getConnectionManager()).thenReturn(connectionManager);
    String httpResponse = new ResourceUtil(CHER_TOP_TRACKS).getContent();
    when(httpClient.execute(Mockito.any(HttpUriRequest.class),
        Mockito.any(ResponseHandler.class))).thenReturn(httpResponse);
   
View Full Code Here

Examples of org.apache.http.conn.ClientConnectionManager

    Scheme http = new Scheme("http", port, PlainSocketFactory.getSocketFactory());
    Scheme https = new Scheme("https", port, new org.apache.http.conn.ssl.SSLSocketFactory(getSslFactory(), null));
    SchemeRegistry sr = new SchemeRegistry();
    sr.register(http);
    sr.register(https);
    ClientConnectionManager connMrg = new BasicClientConnectionManager(sr);
    this.httpClient = new DefaultHttpClient(connMrg);
  }
View Full Code Here

Examples of org.apache.http.conn.ClientConnectionManager

    if (sslConfiguration == null || sslConfiguration.isEmpty()) {
      sslConfiguration = null;
    }

    ClientConnectionManager connectionManager;
    if (sslConfiguration != null) {
      SchemeSocketFactory schemeSocketFactory;
      try {
        javax.net.ssl.SSLSocketFactory sslSocketFactory = sslConfiguration.getSslSocketFactory();
View Full Code Here

Examples of org.apache.http.conn.ClientConnectionManager

        HttpConnectionParams.setTcpNoDelay(parameters, true);

        SchemeRegistry schReg = new SchemeRegistry();
        schReg.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
        schReg.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
        ClientConnectionManager tsccm = new ThreadSafeClientConnManager(parameters, schReg);
       
        DefaultHttpClient defaultHttpClient = new DefaultHttpClient(tsccm, parameters);
        defaultHttpClient.addRequestInterceptor(new HttpRequestInterceptor() {
            public void process(final HttpRequest request, final HttpContext context)
                throws HttpException, IOException {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.