@@ -0,0 +1,1776 @@
+package io.datakernel.http;%0A%0Aimport io.datakernel.async.Promises;%0Aimport io.datakernel.eventloop.Eventloop;%0Aimport io.datakernel.test.TestUtils;%0Aimport io.datakernel.test.rules.ByteBufRule;%0Aimport io.datakernel.test.rules.EventloopRule;%0Aimport org.junit.Before;%0Aimport org.junit.ClassRule;%0Aimport org.junit.Test;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0Aimport java.io.IOException;%0A%0Aimport static io.datakernel.async.TestUtils.await;%0Aimport static java.nio.charset.StandardCharsets.UTF_8;%0A%0Apublic class AsyncHttpServerClientBreakConnectionTest %7B%0A%09private final Logger logger = LoggerFactory.getLogger(AsyncHttpServerClientBreakConnectionTest.class);%0A%09private final int FREE_PORT = TestUtils.getFreePort();%0A%0A%09@ClassRule%0A%09public static final EventloopRule eventloopRule = new EventloopRule();%0A%0A%09@ClassRule%0A%09public static final ByteBufRule bufRule = new ByteBufRule();%0A%0A%09private AsyncHttpServer server;%0A%09private AsyncHttpClient client;%0A%09private Eventloop eventloop = Eventloop.getCurrentEventloop();%0A%0A%09@Before%0A%09public void init() throws IOException %7B%0A%09%09server = AsyncHttpServer.create(eventloop,%0A%09%09%09%09request -%3E %7B%0A%09%09%09%09%09logger.info(%22Closing server...%22);%0A%09%09%09%09%09eventloop.post(() -%3E%0A%09%09%09%09%09%09%09server.close().whenComplete(() -%3E logger.info(%22Server Closed%22)));%0A%09%09%09%09%09return Promises.delay(%0A%09%09%09%09%09%09%09HttpResponse.ok200()%0A%09%09%09%09%09%09%09%09%09.withBody(%22Hello World%22.getBytes()),%0A%09%09%09%09%09%09%09100L);%0A%09%09%09%09%7D)%0A%09%09%09%09.withListenPort(FREE_PORT)%0A%09%09%09%09.withAcceptOnce();%0A%0A%09%09client = AsyncHttpClient.create(eventloop);%0A%09%09server.listen();%0A%09%7D%0A%0A%09@Test%0A%09public void testBreakConnection() %7B%0A%09%09await(client.request(%0A%09%09%09%09HttpRequest.post(%22http://127.0.0.1:%22 + FREE_PORT)%0A%09%09%09%09%09%09.withBody(%22Hello World%22.getBytes()))%0A%09%09%09%09.map(response -%3E%0A%09%09%09%09%09%09response.loadBody()%0A%09%09%09%09%09%09%09%09.map(body -%3E body.getString(UTF_8))));%0A%09%7D%0A%7D%0A

Add test of concurrent closing of AsyncHttpServer