mirror of
https://github.com/jetty/jetty.project.git
synced 2025-03-04 04:49:12 +00:00
Made test more robust.
The check for the connection being closed may fail spuriously because the notification of CompleteListener happens before the connection is closed.
This commit is contained in:
parent
5edf2799e9
commit
9356ab46da
@ -1137,6 +1137,10 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||||||
ContentResponse response = listener.get(2 * timeout, TimeUnit.MILLISECONDS);
|
ContentResponse response = listener.get(2 * timeout, TimeUnit.MILLISECONDS);
|
||||||
|
|
||||||
Assert.assertEquals(200, response.getStatus());
|
Assert.assertEquals(200, response.getStatus());
|
||||||
|
// The parser notifies end-of-content and therefore the CompleteListener
|
||||||
|
// before closing the connection, so we need to wait before checking
|
||||||
|
// that the connection is closed to avoid races.
|
||||||
|
Thread.sleep(1000);
|
||||||
Assert.assertTrue(((HttpConnectionOverHTTP)connection).isClosed());
|
Assert.assertTrue(((HttpConnectionOverHTTP)connection).isClosed());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user