Examples of ApacheHttpClient4Executor


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

   private AtomicLong counter = new AtomicLong();

   @Test
   public void testConnectionCleanupGC() throws Exception
   {
      final ApacheHttpClient4Executor executor = createClient();
      counter.set(0);


      Thread[] threads = new Thread[3];
View Full Code Here

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

   }

   @Test
   public void testConnectionCleanupManual() throws Exception
   {
      final ApacheHttpClient4Executor executor = createClient();
      counter.set(0);


      Thread[] threads = new Thread[3];
View Full Code Here

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

   }

   @Test
   public void testConnectionCleanupProxy() throws Exception
   {
      final ApacheHttpClient4Executor executor = createClient();
      final MyResource proxy = ProxyFactory.create(MyResource.class, "http://localhost:8081", executor);
      counter.set(0);


      Thread[] threads = new Thread[3];
View Full Code Here

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

   }

   @Test
   public void testConnectionCleanupErrorGC() throws Exception
   {
      final ApacheHttpClient4Executor executor = createClient();
      final MyResource proxy = ProxyFactory.create(MyResource.class, "http://localhost:8081", executor);
      counter.set(0);


      Thread[] threads = new Thread[3];
View Full Code Here

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

   }

   @Test
   public void testConnectionCleanupErrorNoGC() throws Exception
   {
      final ApacheHttpClient4Executor executor = createClient();
      final MyResource proxy = ProxyFactory.create(MyResource.class, "http://localhost:8081", executor);
      counter.set(0);


      Thread[] threads = new Thread[3];
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

      // 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

    * supplied through a constructor.
    */
   @Test
   public void testClientRequestSharedExecutor() throws Exception
   {
      ClientExecutor executor = new ApacheHttpClient4Executor();
      ClientRequest request1 = new ClientRequest(generateURL("/test"), executor);
      ClientResponse<?> response1 = request1.post();
      Assert.assertEquals(204, response1.getStatus());
      ClientRequest request2 = new ClientRequest(generateURL("/test"), executor);
      ClientResponse<?> response2 = request2.post();
      Assert.assertEquals(204, response2.getStatus());
      ClientExecutor executor1 = request1.getExecutor();
      ClientExecutor executor2 = request2.getExecutor();
      Assert.assertSame(executor, executor1);
      Assert.assertSame(executor, executor2);
      executor.close();
   }
View Full Code Here

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

    * org.apache.http.conn.ClientConnectionManager.
    */
   @Test
   public void testApacheHttpClient4ExecutorNonSharedHttpClientFinalize() throws Throwable
   {
      ApacheHttpClient4Executor executor = new ApacheHttpClient4Executor();
      ClientRequest request = new ClientRequest(generateURL("/test"), executor);
      ClientResponse<?> response = request.post();
      Assert.assertEquals(204, response.getStatus());
      executor.finalize();
      HttpClient httpClient = executor.getHttpClient();
      HttpPost post = new HttpPost(generateURL("/test"));
      try
      {
         httpClient.execute(post);
         fail("Expected IllegalStateException");
View Full Code Here

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

    * org.apache.http.conn.ClientConnectionManager.
    */
   @Test
   public void testApacheHttpClient4ExecutorNonSharedHttpClientClose() throws Throwable
   {
      ApacheHttpClient4Executor executor = new ApacheHttpClient4Executor();
      ClientRequest request = new ClientRequest(generateURL("/test"), executor);
      ClientResponse<?> response = request.post();
      Assert.assertEquals(204, response.getStatus());
      executor.close();
      HttpClient httpClient = executor.getHttpClient();
      HttpPost post = new HttpPost(generateURL("/test"));
      try
      {
         httpClient.execute(post);
         fail("Expected IllegalStateException");
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.