use of org.apache.http.impl.nio.DefaultNHttpClientConnection in project wso2-synapse by wso2.
the class ClientHandler method getErrorMessage.
/**
* Include remote host and port information to an error message
*
* @param message the initial message
* @param conn the connection encountering the error
* @return the updated error message
*/
private String getErrorMessage(String message, NHttpClientConnection conn) {
if (conn != null && conn instanceof DefaultNHttpClientConnection) {
DefaultNHttpClientConnection c = ((DefaultNHttpClientConnection) conn);
Axis2HttpRequest axis2Request = (Axis2HttpRequest) conn.getContext().getAttribute(AXIS2_HTTP_REQUEST);
if (c.getRemoteAddress() != null) {
return message + " For : " + c.getRemoteAddress().getHostAddress() + ":" + c.getRemotePort() + (axis2Request != null ? " For Request : " + axis2Request : "");
}
}
return message;
}
use of org.apache.http.impl.nio.DefaultNHttpClientConnection in project wso2-synapse by wso2.
the class ClientConnFactory method createConnection.
public DefaultNHttpClientConnection createConnection(final IOSession iosession, final HttpRoute route) {
IOSession customSession;
if (ssl != null && route.isSecure() && !route.isTunnelled()) {
SSLContext customContext = getSSLContext(iosession);
SSLIOSession ssliosession = new SSLIOSession(iosession, SSLMode.CLIENT, customContext, ssl.getHandler());
iosession.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
customSession = ssliosession;
} else {
customSession = iosession;
}
DefaultNHttpClientConnection conn = LoggingUtils.createClientConnection(customSession, responseFactory, allocator, params);
int timeout = HttpConnectionParams.getSoTimeout(params);
conn.setSocketTimeout(timeout);
return conn;
}
Aggregations