AFAIK HttpURLConnection doesn’t actually send the request out until we attempt to read the input. However, if an exception happens here I can’t differentiate between the case where the request was not sent, and the case where the request was sent but some other sort of error occurred (maybe we entered a tunnel so couldn’t receive the response).
Is there a way to query and find out if the request was actually sent or not?
You might have some luck with
You can get a full list of response codes at http://download.oracle.com/javase/1,5.0/docs/api/java/net/HttpURLConnection.html
Having said that I can imagine your data going out completely an instant before you enter a tunnel and the connection not having a response code set, in which case you would try to send again (perhaps using a unique ‘send id’) so that the listener knows to ignore you resend but can still let you know that it was received.