OldHttpClientApi { public void post(){ String requesturl = "http: PostMethod postMethod = new PostMethod(requesturl); String APIKEY = "4b441cb500f431adc6cc0cb650b4a5d0"; String INFO ="北京时间"; NameValuePair nvp1=new NameValuePair("key",APIKEY); NameValuePair nvp2=new NameValuePair("info",INFO); NameValuePair[] data = new NameValuePair[2]; data[0]=nvp1; data[1]=nvp2; postMethod.setRequestBody(data); postMethod.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET,"utf-8"); try { byte[] responseBody = executeMethod(postMethod,10000); String content=new String(responseBody ,"utf-8"); log.info(content); }catch (Exception e){ log.error(""+e.getLocalizedMessage()); }finally { postMethod.releaseConnection(); } }  void post(); void get(); void get2();  }
@Test public void testPost() throws Exception { old.post(); }