How does the timeout work in Restlet's client class?

Posted by Greg Noe on Stack Overflow See other posts from Stack Overflow or by Greg Noe
Published on 2009-08-14T15:30:20Z Indexed on 2010/03/30 21:03 UTC
Read the original article Hit count: 471

Filed under:
|
|
|

Here's some code:

Client client = new Client(Protocol.HTTP);
client.setConnectTimeout(1); //milliseconds
Response response = client.post(url, paramRepresentation);
System.out.println("timed out");

What I would expect to happen is that it prints "timed out" before the resource has time to process. Instead, nothing happens with the timeout and it doesn't print "timed out" until after the resource returns. Even if I put a Thread.sleep(5000) at the resource that's handling the request, the entire sleep is performed, like the timeout did nothing.

Anyone have experience with this? I'm using Restlet 1.1.1. Thanks.

© Stack Overflow or respective owner

Related posts about restlet

Related posts about timeout