Fixed test that was spin looping causing lots of allocations and GC pressure.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2023-12-12 20:19:44 +01:00
parent f620f99c78
commit 8057cb30ba
No known key found for this signature in database
GPG Key ID: 1677D141BCF3584D
1 changed files with 13 additions and 5 deletions

View File

@ -230,14 +230,20 @@ public class HttpReceiverOverHTTPTest
{
return new HttpReceiverOverHTTP(this)
{
private boolean once = true;
@Override
protected void fillInterested()
{
// Verify that the buffer has been released
// before fillInterested() is called.
assertNull(getResponseBuffer());
// Fill the endpoint so receive is called again.
endPoint.addInput("X");
if (once)
{
once = false;
// Verify that the buffer has been released
// before fillInterested() is called.
assertNull(getResponseBuffer());
// Fill the endpoint so receive is called again.
endPoint.addInput("X");
}
super.fillInterested();
}
};
@ -260,5 +266,7 @@ public class HttpReceiverOverHTTPTest
Response response = listener.get(5, TimeUnit.SECONDS);
assertNotNull(response);
assertEquals(200, response.getStatus());
Thread.sleep(2000);
}
}