salilbc / rest-assured

Automatically exported from code.google.com/p/rest-assured
0 stars 0 forks source link

how to set the http timeout with restassured #255

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Looking for the way to set the http timeout and keep the connection alive until 
finished getting complete response.

What steps will reproduce the problem?
1. send the request
2. the service has around 1 second delay of the response
3. try to get the response body from the response
(the response body not so large)
the issue happens randomly

What is the expected output? What do you see instead?
randomly getting: 
org.apache.http.ConnectionClosedException: Premature end of Content-Length 
delimited message body (expected: 4683; received: 4187
    at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:184)
    at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:138)
    at com.jayway.restassured.internal.support.CloseHTTPClientConnectionInputStreamWrapper.read(CloseHTTPClientConnectionInputStreamWrapper.java:49)
    at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283)
    at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325)
    at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
    at java.io.InputStreamReader.read(InputStreamReader.java:184)
    at java.io.BufferedReader.fill(BufferedReader.java:154)
    at java.io.BufferedReader.read1(BufferedReader.java:205)
    at java.io.BufferedReader.read(BufferedReader.java:279)
    at java.io.Reader.read(Reader.java:140)
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1928)
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1907)
    at org.apache.commons.io.IOUtils.copy(IOUtils.java:1884)
    at org.apache.commons.io.IOUtils.toString(IOUtils.java:746)

What version of the product are you using? On what operating system?
1.7.2 restassured on linux red hat 4.1.2-46

Please provide any additional information below.

Original issue reported on code.google.com by zhouchen...@gmail.com on 29 Aug 2013 at 8:05

GoogleCodeExporter commented 8 years ago
Perhaps you can use the HttpClientConfig or ConnectionConfig in Rest Assured, 
see https://code.google.com/p/rest-assured/wiki/Usage#Detailed_configuration 
for more info.

Note: I'm marking this as a "invalid" since it's a question. Please use the 
mailing list for asking questions.

Original comment by johan.ha...@gmail.com on 3 Sep 2013 at 2:20