Fix flaky test from #6562 Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
parent
b8370f679c
commit
2f80582615
|
@ -23,7 +23,6 @@ import java.nio.channels.ReadableByteChannel;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import javax.servlet.AsyncContext;
|
||||
import javax.servlet.ServletException;
|
||||
|
@ -818,7 +817,7 @@ public class HttpOutputTest
|
|||
@Test
|
||||
public void testEmptyBuffer() throws Exception
|
||||
{
|
||||
AtomicBoolean committed = new AtomicBoolean();
|
||||
FuturePromise<Boolean> committed = new FuturePromise<>();
|
||||
AbstractHandler handler = new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
|
@ -827,7 +826,7 @@ public class HttpOutputTest
|
|||
baseRequest.setHandled(true);
|
||||
response.setStatus(200);
|
||||
((HttpOutput)response.getOutputStream()).write(ByteBuffer.wrap(new byte[0]));
|
||||
committed.set(response.isCommitted());
|
||||
committed.succeeded(response.isCommitted());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -835,13 +834,13 @@ public class HttpOutputTest
|
|||
handler.start();
|
||||
String response = _connector.getResponse("GET / HTTP/1.0\nHost: localhost:80\n\n");
|
||||
assertThat(response, containsString("HTTP/1.1 200 OK"));
|
||||
assertThat(committed.get(), is(false));
|
||||
assertThat(committed.get(10, TimeUnit.SECONDS), is(false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyBufferKnown() throws Exception
|
||||
{
|
||||
AtomicBoolean committed = new AtomicBoolean();
|
||||
FuturePromise<Boolean> committed = new FuturePromise<>();
|
||||
AbstractHandler handler = new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
|
@ -851,7 +850,7 @@ public class HttpOutputTest
|
|||
response.setStatus(200);
|
||||
response.setContentLength(0);
|
||||
((HttpOutput)response.getOutputStream()).write(ByteBuffer.wrap(new byte[0]));
|
||||
committed.set(response.isCommitted());
|
||||
committed.succeeded(response.isCommitted());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -860,7 +859,7 @@ public class HttpOutputTest
|
|||
String response = _connector.getResponse("GET / HTTP/1.0\nHost: localhost:80\n\n");
|
||||
assertThat(response, containsString("HTTP/1.1 200 OK"));
|
||||
assertThat(response, containsString("Content-Length: 0"));
|
||||
assertThat(committed.get(), is(true));
|
||||
assertThat(committed.get(10, TimeUnit.SECONDS), is(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue