@Test
 public void testMultipleServerClose() {
   this.server =
       vertx.createHttpServer(new HttpServerOptions().setPort(HttpTestBase.DEFAULT_HTTP_PORT));
   AtomicInteger times = new AtomicInteger();
   // We assume the endHandler and the close completion handler are invoked in the same context
   // task
   ThreadLocal stack = new ThreadLocal();
   stack.set(true);
   server
       .websocketStream()
       .endHandler(
           v -> {
             assertNull(stack.get());
             assertTrue(Vertx.currentContext().isEventLoopContext());
             times.incrementAndGet();
           });
   server.close(
       ar1 -> {
         assertNull(stack.get());
         assertTrue(Vertx.currentContext().isEventLoopContext());
         server.close(
             ar2 -> {
               server.close(
                   ar3 -> {
                     assertEquals(1, times.get());
                     testComplete();
                   });
             });
       });
   await();
 }
 @Test
 public void testWebsocketStreamCallbackAsynchronously() {
   this.server =
       vertx.createHttpServer(new HttpServerOptions().setPort(HttpTestBase.DEFAULT_HTTP_PORT));
   AtomicInteger done = new AtomicInteger();
   ServerWebSocketStream stream = server.websocketStream();
   stream.handler(req -> {});
   ThreadLocal<Object> stack = new ThreadLocal<>();
   stack.set(true);
   stream.endHandler(
       v -> {
         assertTrue(Vertx.currentContext().isEventLoopContext());
         assertNull(stack.get());
         if (done.incrementAndGet() == 2) {
           testComplete();
         }
       });
   server.listen(
       ar -> {
         assertTrue(Vertx.currentContext().isEventLoopContext());
         assertNull(stack.get());
         ThreadLocal<Object> stack2 = new ThreadLocal<>();
         stack2.set(true);
         server.close(
             v -> {
               assertTrue(Vertx.currentContext().isEventLoopContext());
               assertNull(stack2.get());
               if (done.incrementAndGet() == 2) {
                 testComplete();
               }
             });
         stack2.set(null);
       });
   await();
 }