-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide methods in Request class to set connection and read timeouts #29
Comments
Now that you mention it... yeah, I don't know what happened when I was coding that... :P Is it absolutely necessary to support both timeouts? wouldn't the connect timeout just do? Thanks! |
I need the read timeout because I'm processing a persistent stream of data via getInputStream() for a long duration. In case the connection is dropped, the read timeout is necessary so that an IOException is thrown. The connection timeout is only useful for the initial connection. |
Ok. planned for 1.0.8 |
Great thanks! Let me know if you want me to make this change so you can pull/merge. |
Yes that would be awesome. Just note the 2 spaces for indent and the K&R braces. Thanks! |
I just sent you a pull request for this. Let me know when 1.0.8 is available! |
Merged, I just changed the signature to this: setConnectTimeout(int duration, TimeUnit unit) so you can set the timeout both in seconds and millis. |
Can you add public methods to the Request class so that connection and read timeouts can be set on the contained HttpURLConnection object? I see that you have a setTimeout() method but if I'm not mistaken, it can't be used properly as is. The "timeout" variable is acted upon in the constructor so by the time the setTimeout() method is called, it's already too late.
Effectively, I would like wrapper methods around HttpURLConnection's setConnectTimeout() and setReadTimeout() methods.
BTW - awesome library!
The text was updated successfully, but these errors were encountered: