Package org.apache.commons.httpclient.methods

Examples of org.apache.commons.httpclient.methods.GetMethod.releaseConnection()


         String response1 = get1.getResponseBodyAsString();
         get1.releaseConnection();
         int status2 = client.executeMethod(get2);
         assertEquals(status2, 200);
         String response2 = get2.getResponseBodyAsString();
         get2.releaseConnection();
         assertEquals(response1, response2);
      }
      catch (Exception e)
      {
         throw new RuntimeException(e);
View Full Code Here


         responseCode = httpConn.executeMethod(indexGet);
         assertEquals(HttpURLConnection.HTTP_FORBIDDEN, responseCode);
      }
      finally
      {
         indexGet.releaseConnection();
      }
      indexGet = null;
      try
      {
         indexGet = new GetMethod(location);
View Full Code Here

         responseCode = httpConn.executeMethod(indexGet);
         assertEquals(HttpURLConnection.HTTP_OK, responseCode);
      }
      finally
      {
         indexGet.releaseConnection();
      }
   }
}
View Full Code Here

         assertTrue("Unexpected response code received: " + responseCode, responseCode == HttpURLConnection.HTTP_OK);
         assertTrue("Failed to redirect the request to the login page", body.indexOf("j_security_check") > 0);
      }
      finally
      {
         getMethod.releaseConnection();
      }

      HttpState state = this.httpClient.getState();
      // fill in the login form and submit it
      PostMethod postMethod = new PostMethod(this.testAppBaseURL + "j_security_check");
View Full Code Here

         // assert the redirection of to the SecureServlet
         assertTrue("Redirect to SecureServlet has failed", body.indexOf("SecureServlet") > 0);
      }
      finally
      {
         getMethod.releaseConnection();
      }
   }

   /**
    * <p>
 
View Full Code Here

         assertTrue("Access to SecureServlet has not been granted", body.indexOf("SecureServlet") > 0);
      }
      finally
      {
         // release the connection
         method.releaseConnection();
      }
   }

   public static Test suite() throws Exception
   {
View Full Code Here

      {
         GetMethod method = new GetMethod("http://localhost:8080/resteasy/basic");
         int status = client.executeMethod(method);
         Assert.assertEquals(HttpResponseCodes.SC_OK, status);
         Assert.assertEquals("basic", method.getResponseBodyAsString());
         method.releaseConnection();
      }
      {
         // I'm testing unknown content-length here
         GetMethod method = new GetMethod("http://localhost:8080/resteasy/xml");
         int status = client.executeMethod(method);
View Full Code Here

         Assert.assertEquals(HttpResponseCodes.SC_OK, status);
         String result = method.getResponseBodyAsString();
         JAXBContext ctx = JAXBContext.newInstance(Customer.class);
         Customer cust = (Customer) ctx.createUnmarshaller().unmarshal(new StringReader(result));
         Assert.assertEquals("Bill Burke", cust.getName());
         method.releaseConnection();
      }

   }

   public String readString(InputStream in) throws IOException
View Full Code Here

         String response1 = get1.getResponseBodyAsString();
         get1.releaseConnection();
         int status2 = client.executeMethod(get2);
         assertEquals(status2, 200);
         String response2 = get2.getResponseBodyAsString();
         get2.releaseConnection();
         assertFalse(response1.equals(response2));
      }
      catch (Exception e)
      {
         throw new RuntimeException(e);
View Full Code Here

         {
            return Integer.valueOf(CleanShutdownTestCase.this.client.executeMethod(method));
         }
         finally
         {
            method.releaseConnection();
         }
      }
   }
}
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.