/** Test that the body can be set as a String without an explict content type */
  public void testStringBodyToBodyServlet() throws Exception {
    PostMethod method = new PostMethod("/");
    String stringBody = "pname1=pvalue1&pname2=pvalue2";

    method.setRequestEntity(new StringRequestEntity(stringBody, null, null));
    this.server.setHttpService(new EchoService());
    try {
      this.client.executeMethod(method);
      assertEquals(200, method.getStatusCode());
      String body = method.getResponseBodyAsString();
      assertEquals("pname1=pvalue1&pname2=pvalue2", body);
    } finally {
      method.releaseConnection();
    }
  }
  /** Test that parameters can be added. */
  public void testAddParametersToParamServlet() throws Exception {
    PostMethod method = new PostMethod("/");

    method.addParameter(new NameValuePair("pname1", "pvalue1"));
    method.addParameter(new NameValuePair("pname2", "pvalue2"));

    this.server.setHttpService(new EchoService());
    try {
      this.client.executeMethod(method);
      assertEquals(200, method.getStatusCode());
      String body = method.getResponseBodyAsString();
      assertEquals("pname1=pvalue1&pname2=pvalue2", body);
    } finally {
      method.releaseConnection();
    }
  }