Consume the http response to avoid IO exception
This commit is contained in:
@@ -57,6 +57,10 @@ public class TestImage extends WebappTestCase {
|
|||||||
SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss ZZZ", Locale.ENGLISH);
|
SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss ZZZ", Locale.ENGLISH);
|
||||||
Date lastModified = format.parse( response.getHeaderField( "Last-Modified"));
|
Date lastModified = format.parse( response.getHeaderField( "Last-Modified"));
|
||||||
assertTrue( "Last-Modified is not in the past", lastModified.before( new Date()));
|
assertTrue( "Last-Modified is not in the past", lastModified.before( new Date()));
|
||||||
Thread.sleep(500); // Time to receive the image
|
// Consume the response
|
||||||
|
InputStream responseStream = response.getInputStream();
|
||||||
|
while( responseStream.read() != -1) {
|
||||||
|
; // Do nothing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user