Reputation: 6717
Is there any way to fire an event if HttpURLConnection
has timeout before complete?
Upvotes: 1
Views: 1820
Reputation: 311050
URLConnection.setConnectTimeout()
URLConnection.setReadTimeout()
@since 1.5
Upvotes: 1
Reputation: 75496
There is no built-in timeout for this. What I do is to use a different thread and interrupt the thread after the timeout.
It's easier to use FutureTask for this. See my answer to this question,
Upvotes: 2