private HttpClient httpClient = new HttpClient(new MultiThreadedHttpConnectionManager());
**** Это мой метод публикации ******* publi c int post (String url, String message, EventMessage eventMessage) выдает исключение HttpChannelException {
PostMethod post = new PostMethod(url);
int result=0;
try{
String scheme = "https";
Protocol baseHttps = Protocol.getProtocol(scheme);
//int defaultPort = baseHttps.getDefaultPort();
ProtocolSocketFactory socketFactory = new EasySSLProtocolSocketFactory();
ProtocolSocketFactory baseFactory = baseHttps.getSocketFactory();
ProtocolSocketFactory customFactory = new CustomHttpsSocketFactory(socketFactory);
Protocol customHttps = new Protocol(scheme, customFactory, 443);
Protocol.registerProtocol(scheme, customHttps);
RequestEntity entity = new StringRequestEntity(message, "text/xml", "UTF-8");
post.setRequestEntity( entity );
HttpConnectionParams connectionParam = httpClient.getHttpConnectionManager().getParams();
connectionParam.setConnectionTimeout(1000*getHttpTimeOut());
connectionParam.setSoTimeout(1000*getHttpTimeOut());
HttpConnectionManagerParams connectionManagerParams =
httpClient.getHttpConnectionManager().getParams();
connectionManagerParams.setDefaultMaxConnectionsPerHost(5);
Date startDate = new Date();
log.debug("Invoking httpclient ...");
result = this.httpClient.executeMethod(post);
String responseBody = convertStreamToString(post.getResponseBodyAsStream());
log.debug("httpclient result " + result+" Response body: " + responseBody);
Пожалуйста, дайте мне знать, что не так в коде? Спасибо