I am calling an api to send sms with a java apache common client, and it looks like setting a time out for more than 0 is returning a "java.net.SocketException: Connection reset" error.
Here is a the code sample
// creating the http client
HttpClient client = new HttpClient();
Setting a connection time out of 10 sec (I receive a successful response as soon as I remove this part of the code)
client.getHttpConnectionManager().
getParams().setConnectionTimeout(10000);
Rest of the code
//creating the request method
GetMethod method = new GetMethod(smsUrl);
// setting its params
method.setQueryString(new NameValuePair[] {
new NameValuePair("username", user),
new NameValuePair("password", pass),
new NameValuePair("action", "sendsms"),
new NameValuePair("from", "Woosh"),
new NameValuePair("to", toMobile),
new NameValuePair("text", textBody)
});
//calling the method
method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
new DefaultHttpMethodRetryHandler(3, false));
int statusCode = client.executeMethod(method);