header, boolean needHeader, FutureCallbackcallback) throws Exception {
HttpPost post = new HttpPost(url);
URL testUrl = new URL(url);
HttpURLConnection urlConnection = (HttpURLConnection)testUrl.openConnection();
try {
urlConnection.connect();
} catch (IOException e) {
throw new ConnectException(e.getMessage());
} finally {
urlConnection.disconnect();
}
if(needHeader){
for(String key : header.keySet()){
post.setHeader(key, header.get(key));
}
}
// 传入HttpPost
httpclient.start();
try{
log.info("HttpAsyncUtils httpPostCallback Param : {}", params);
if (params != null) {
post.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));
}
httpclient.execute(post, callback);
} catch(Exception e) {
e.printStackTrace();
} finally {
}
}
}