Esempio n. 1
0
 public void testHttpPost() throws URISyntaxException, HttpException, IOException {
   URI uri = new URI(HTTP_LOCALHOST_60198);
   PostMethod postMethod = new PostMethod(uri.toString());
   postMethod.setRequestEntity(new StringRequestEntity(TEST_MESSAGE));
   HttpConnection cnn = new HttpConnection(uri.getHost(), uri.getPort());
   cnn.open();
   postMethod.execute(new HttpState(), cnn);
   System.out.println("PostResponse: " + postMethod.getResponseBodyAsString());
 }