mirror of
https://github.com/jlengrand/vert.x.git
synced 2026-03-10 08:51:19 +00:00
Improve Http1xTest#testCloseTheConnectionAfterResetBeforeResponseReceived reliability
This commit is contained in:
@@ -3403,6 +3403,7 @@ public class Http1xTest extends HttpTest {
|
||||
server.close();
|
||||
NetServer server = vertx.createNetServer();
|
||||
CompletableFuture<Void> requestReceived = new CompletableFuture<>();
|
||||
CompletableFuture<Void> sendResponse = new CompletableFuture<>();
|
||||
try {
|
||||
AtomicInteger count = new AtomicInteger();
|
||||
AtomicBoolean closed = new AtomicBoolean();
|
||||
@@ -3416,12 +3417,14 @@ public class Http1xTest extends HttpTest {
|
||||
"host: localhost:8080\r\n" +
|
||||
"\r\n")) {
|
||||
requestReceived.complete(null);
|
||||
so.write(Buffer.buffer(
|
||||
sendResponse.whenComplete((v, err) -> {
|
||||
so.write(Buffer.buffer(
|
||||
"HTTP/1.1 200 OK\r\n" +
|
||||
"Content-Length: 11\r\n" +
|
||||
"\r\n" +
|
||||
"Some-Buffer"
|
||||
));
|
||||
"Content-Length: 11\r\n" +
|
||||
"\r\n" +
|
||||
"Some-Buffer"
|
||||
));
|
||||
});
|
||||
so.closeHandler(v -> {
|
||||
closed.set(true);
|
||||
});
|
||||
@@ -3458,6 +3461,7 @@ public class Http1xTest extends HttpTest {
|
||||
client.close();
|
||||
client = vertx.createHttpClient(createBaseClientOptions().setMaxPoolSize(1).setPipelining(pipelined).setKeepAlive(true));
|
||||
HttpClientRequest req1 = client.request(HttpMethod.GET, testAddress, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, "/1");
|
||||
req1.exceptionHandler(err -> sendResponse.complete(null));
|
||||
if (pipelined) {
|
||||
requestReceived.thenAccept(v -> {
|
||||
req1.reset();
|
||||
|
||||
Reference in New Issue
Block a user