Examples of ApacheHttpClient4Executor


Examples of org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor

    */
   @Test
   public void testApacheHttpClient4ExecutorSharedHttpClientFinalize() throws Throwable
   {
      HttpClient httpClient = new DefaultHttpClient();
      ApacheHttpClient4Executor executor = new ApacheHttpClient4Executor(httpClient);
      ClientRequest request = new ClientRequest(generateURL("/test"), executor);
      ClientResponse<?> response = request.post();
      Assert.assertEquals(204, response.getStatus());
      executor.finalize();
      Assert.assertEquals(httpClient, executor.getHttpClient());
      HttpPost post = new HttpPost(generateURL("/test"));
      HttpResponse httpResponse = httpClient.execute(post);
      Assert.assertEquals(204, httpResponse.getStatusLine().getStatusCode());
      httpClient.getConnectionManager().shutdown();
   }
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor

    */
   @Test
   public void testApacheHttpClient4ExecutorSharedHttpClientClose() throws Throwable
   {
      HttpClient httpClient = new DefaultHttpClient();
      ApacheHttpClient4Executor executor = new ApacheHttpClient4Executor(httpClient);
      ClientRequest request = new ClientRequest(generateURL("/test"), executor);
      ClientResponse<?> response = request.post();
      Assert.assertEquals(204, response.getStatus());
      executor.close();
      Assert.assertEquals(httpClient, executor.getHttpClient());
      HttpPost post = new HttpPost(generateURL("/test"));
      HttpResponse httpResponse = httpClient.execute(post);
      Assert.assertEquals(204, httpResponse.getStatusLine().getStatusCode());
      httpClient.getConnectionManager().shutdown();
   }
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor

   @Test
   public void testStreamClosedWhenGetEntity() throws Exception
   {
      HttpClient httpClient = new DefaultHttpClient();
      ClientExecutor clientExecutor = new ApacheHttpClient4Executor(httpClient);

      ResteasyProviderFactory pf = ResteasyProviderFactory.getInstance();
      pf.addClientErrorInterceptor(new MyClienteErrorInterceptor());

      MyResource proxy = ProxyFactory.create(MyResource.class, URI.create(generateBaseUrl()), clientExecutor, pf);
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor

   @Test
   public void testStreamClosedWhenGetEntityForVoid() throws Exception
   {
      HttpClient httpClient = new DefaultHttpClient();
      ClientExecutor clientExecutor = new ApacheHttpClient4Executor(httpClient);

      ResteasyProviderFactory pf = ResteasyProviderFactory.getInstance();
      pf.addClientErrorInterceptor(new MyClienteErrorInterceptor());

      MyResource proxy = ProxyFactory.create(MyResource.class, URI.create(generateBaseUrl()), clientExecutor, pf);
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor

      // Add AuthCache to the execution context
      BasicHttpContext localContext = new BasicHttpContext();
      localContext.setAttribute(ClientContext.AUTH_CACHE, authCache);
     
      // Create ClientExecutor.
      ApacheHttpClient4Executor executor = new ApacheHttpClient4Executor(client, localContext);
      return executor;
   }
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor

      if (clientExecutor == null)
      {
         if (httpClient == null)
         {
            clientExecutor = new ApacheHttpClient4Executor();
         }
         else
         {
            clientExecutor = new ApacheHttpClient4Executor(httpClient);
         }
         client = ProxyFactory.create(serviceInterface, baseUri, clientExecutor,
                 resteasyProviderFactory);
      }
      else
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor

      // This connection manager must be used if more than one thread will
      // be using the HttpClient.
      ClientConnectionManager cm = new ThreadSafeClientConnManager(params, schemeRegistry);
      HttpClient httpClient = new DefaultHttpClient(cm, params);

      final ApacheHttpClient4Executor executor = new ApacheHttpClient4Executor(httpClient);
      return executor;

   }
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor

      if (providerFactory == null)
         this.providerFactory = ResteasyProviderFactory.getInstance();
      else
         this.providerFactory = providerFactory;
      if (executor == null)
        this.executor = new ApacheHttpClient4Executor();
      else
         this.executor = executor;
      this.base = base;
   }
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor

   }
  
   static private void shutdown(ClientRequest request) throws Exception
   {
//      request.getExecutor().close();
      ApacheHttpClient4Executor executor = (ApacheHttpClient4Executor) request.getExecutor();
      executor.getHttpClient().getConnectionManager().shutdown();
   }
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor

      }
   }

   private void shutdownConnections(ClientRequest request)
   {
      ApacheHttpClient4Executor executor = (ApacheHttpClient4Executor) request.getExecutor();
      executor.getHttpClient().getConnectionManager().shutdown();
//      try
//      {
//         request.getExecutor().close();
//      } catch (Exception e)
//      {
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.