Created
March 12, 2014 22:56
-
-
Save jdmullin/9518274 to your computer and use it in GitHub Desktop.
Resty with URLConnection read timeout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ReadTimeoutOption extends Resty.Option { | |
private final int _readTimeout; | |
public ReadTimeoutOption(int milliseconds) { | |
_readTimeout = milliseconds; | |
} | |
public void apply(URLConnection aConnection) { | |
aConnection.setReadTimeout(_readTimeout); | |
} | |
} | |
@Test | |
public void testReadTimeout() throws IOException { | |
Resty r = new Resty(new ReadTimeoutOption(500)); | |
// do cool stuff and have a read timeout now... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment