Hi
I have a strange situation at hand. I have a webapi running on a server with a
valid SSL certificate (bought from Go Daddy). While the connection works
perfectly for extended periods of time (10-15 hours) and my app is able to get
data over https, for some strange reason after 10-15 hours the
HttpsURLConnection starts throwing IOExceptions with ‘Hostname <servername> was
not verified’ message. The IOException will keep happening till I restart the
app. Below is the outline of the code that I am using. Has anybody faced a
similar problem? It seems like a SSL handshaking issue but I am not able to
figure out why it would come 10-15 hours later and go away with an app restart.
While the app is raising exceptions, I can switch to the browser and access the
same https url with no issue.
URL url = null;
HttpsURLConnection urlc = null;
try {
url = new URL(“https://test.example.com/webapi");
urlc = (HttpsURLConnection) url.openConnection();
urlc.setRequestProperty("Connection", "close");
urlc.setConnectTimeout(15000);
urlc.setReadTimeout(10000);
urlc.connect();
if (urlc.getResponseCode() == 200) { // Good response
mCloudAlive = true;
Log.d("CLOUDSTATUS", "*internet connection to server
found* ".concat(urlc.getResponseMessage()));
NotificationHandler.setCloudConnectionStatus(true);
} else {
mCloudAlive = false;
Log.d("CLOUDSTATUS", "internet connection to server
error ".concat(urlc.getResponseMessage()));
NotificationHandler.setCloudConnectionStatus(false);
}
} catch (IOException e) {
mCloudAlive = false;
Log.d("CLOUDSTATUS", "server io exception
".concat(e.getMessage()));
NotificationHandler.setCloudConnectionStatus(false);
} finally {
urlc.disconnect();
}
—
Thanks
Pankaj
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.