Skip to content

Instantly share code, notes, and snippets.

@jdmullin
Created March 12, 2014 22:56
Show Gist options
  • Save jdmullin/9518274 to your computer and use it in GitHub Desktop.
Save jdmullin/9518274 to your computer and use it in GitHub Desktop.
Resty with URLConnection read timeout
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