Search in sources :

Example 76 with Handler

use of io.vertx.core.Handler in project vert.x by eclipse.

the class Http2ServerTest method testClientSendGoAwayNoError.

@Test
public void testClientSendGoAwayNoError() throws Exception {
    Future<Void> abc = Future.future();
    Context ctx = vertx.getOrCreateContext();
    Handler<HttpServerRequest> requestHandler = req -> {
        HttpConnection conn = req.connection();
        AtomicInteger numShutdown = new AtomicInteger();
        AtomicBoolean completed = new AtomicBoolean();
        conn.shutdownHandler(v -> {
            assertOnIOContext(ctx);
            numShutdown.getAndIncrement();
            vertx.setTimer(100, timerID -> {
                completed.set(true);
                testComplete();
            });
        });
        conn.goAwayHandler(ga -> {
            assertOnIOContext(ctx);
            assertEquals(0, numShutdown.get());
            req.response().end();
        });
        conn.closeHandler(v -> {
            assertTrue(completed.get());
        });
        abc.complete();
    };
    server.requestHandler(requestHandler);
    startServer(ctx);
    TestClient client = new TestClient();
    ChannelFuture fut = client.connect(DEFAULT_HTTPS_PORT, DEFAULT_HTTPS_HOST, request -> {
        Http2ConnectionEncoder encoder = request.encoder;
        int id = request.nextStreamId();
        encoder.writeHeaders(request.context, id, GET("/"), 0, true, request.context.newPromise());
        request.context.flush();
        abc.setHandler(ar -> {
            encoder.writeGoAway(request.context, id, 0, Unpooled.EMPTY_BUFFER, request.context.newPromise());
            request.context.flush();
        });
    });
    fut.sync();
    await();
}
Also used : Context(io.vertx.core.Context) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) Arrays(java.util.Arrays) GZIPInputStream(java.util.zip.GZIPInputStream) HttpServer(io.vertx.core.http.HttpServer) MultiMap(io.vertx.core.MultiMap) Http2ConnectionEncoder(io.netty.handler.codec.http2.Http2ConnectionEncoder) DefaultHttp2Connection(io.netty.handler.codec.http2.DefaultHttp2Connection) Context(io.vertx.core.Context) Unpooled(io.netty.buffer.Unpooled) Http2ConnectionDecoder(io.netty.handler.codec.http2.Http2ConnectionDecoder) ByteArrayInputStream(java.io.ByteArrayInputStream) HttpVersion(io.vertx.core.http.HttpVersion) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Http2Exception(io.netty.handler.codec.http2.Http2Exception) Map(java.util.Map) ApplicationProtocolNegotiationHandler(io.netty.handler.ssl.ApplicationProtocolNegotiationHandler) ReadStream(io.vertx.core.streams.ReadStream) AbstractHttp2ConnectionHandlerBuilder(io.netty.handler.codec.http2.AbstractHttp2ConnectionHandlerBuilder) Http2FrameAdapter(io.netty.handler.codec.http2.Http2FrameAdapter) StreamResetException(io.vertx.core.http.StreamResetException) ChannelDuplexHandler(io.netty.channel.ChannelDuplexHandler) ChannelInitializer(io.netty.channel.ChannelInitializer) Http2Flags(io.netty.handler.codec.http2.Http2Flags) Set(java.util.Set) ChannelPipeline(io.netty.channel.ChannelPipeline) Http2ConnectionHandler(io.netty.handler.codec.http2.Http2ConnectionHandler) Future(io.vertx.core.Future) InetSocketAddress(java.net.InetSocketAddress) Collectors(java.util.stream.Collectors) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup) StandardCharsets(java.nio.charset.StandardCharsets) Base64(java.util.Base64) List(java.util.List) Buffer(io.vertx.core.buffer.Buffer) SslHandler(io.netty.handler.ssl.SslHandler) Http2Headers(io.netty.handler.codec.http2.Http2Headers) HttpServerResponse(io.vertx.core.http.HttpServerResponse) Http2Error(io.netty.handler.codec.http2.Http2Error) HttpClient(io.vertx.core.http.HttpClient) NetSocket(io.vertx.core.net.NetSocket) Trust(io.vertx.test.core.tls.Trust) NioSocketChannel(io.netty.channel.socket.nio.NioSocketChannel) HttpServerRequest(io.vertx.core.http.HttpServerRequest) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Http2EventAdapter(io.netty.handler.codec.http2.Http2EventAdapter) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) HashMap(java.util.HashMap) AtomicReference(java.util.concurrent.atomic.AtomicReference) Function(java.util.function.Function) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) HttpClientRequest(io.vertx.core.http.HttpClientRequest) ByteBuf(io.netty.buffer.ByteBuf) WriteStream(io.vertx.core.streams.WriteStream) Http2Stream(io.netty.handler.codec.http2.Http2Stream) BiConsumer(java.util.function.BiConsumer) AsyncResult(io.vertx.core.AsyncResult) HttpClientOptions(io.vertx.core.http.HttpClientOptions) HttpConnection(io.vertx.core.http.HttpConnection) EventLoopGroup(io.netty.channel.EventLoopGroup) VertxInternal(io.vertx.core.impl.VertxInternal) ClosedChannelException(java.nio.channels.ClosedChannelException) Vertx(io.vertx.core.Vertx) FileOutputStream(java.io.FileOutputStream) ApplicationProtocolNames(io.netty.handler.ssl.ApplicationProtocolNames) Test(org.junit.Test) IOException(java.io.IOException) SSLHelper(io.vertx.core.net.impl.SSLHelper) File(java.io.File) ChannelFuture(io.netty.channel.ChannelFuture) Channel(io.netty.channel.Channel) Http2Settings(io.netty.handler.codec.http2.Http2Settings) TimeUnit(java.util.concurrent.TimeUnit) Consumer(java.util.function.Consumer) Bootstrap(io.netty.bootstrap.Bootstrap) AtomicLong(java.util.concurrent.atomic.AtomicLong) Http2Connection(io.netty.handler.codec.http2.Http2Connection) HttpMethod(io.vertx.core.http.HttpMethod) HttpUtils(io.vertx.core.http.impl.HttpUtils) HttpServerOptions(io.vertx.core.http.HttpServerOptions) HttpHeaderNames(io.netty.handler.codec.http.HttpHeaderNames) Handler(io.vertx.core.Handler) Collections(java.util.Collections) TestUtils.assertIllegalStateException(io.vertx.test.core.TestUtils.assertIllegalStateException) DefaultHttp2Headers(io.netty.handler.codec.http2.DefaultHttp2Headers) ChannelFuture(io.netty.channel.ChannelFuture) HttpConnection(io.vertx.core.http.HttpConnection) HttpServerRequest(io.vertx.core.http.HttpServerRequest) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Http2ConnectionEncoder(io.netty.handler.codec.http2.Http2ConnectionEncoder) Test(org.junit.Test)

Example 77 with Handler

use of io.vertx.core.Handler in project vert.x by eclipse.

the class FutureTest method testDefaultCompleter.

@Test
public void testDefaultCompleter() {
    AsyncResult<Object> succeededAsyncResult = new AsyncResult<Object>() {

        Object result = new Object();

        public Object result() {
            return result;
        }

        public Throwable cause() {
            throw new UnsupportedOperationException();
        }

        public boolean succeeded() {
            return true;
        }

        public boolean failed() {
            throw new UnsupportedOperationException();
        }

        public <U> AsyncResult<U> map(Function<Object, U> mapper) {
            throw new UnsupportedOperationException();
        }

        public <V> AsyncResult<V> map(V value) {
            throw new UnsupportedOperationException();
        }
    };
    AsyncResult<Object> failedAsyncResult = new AsyncResult<Object>() {

        Throwable cause = new Throwable();

        public Object result() {
            throw new UnsupportedOperationException();
        }

        public Throwable cause() {
            return cause;
        }

        public boolean succeeded() {
            return false;
        }

        public boolean failed() {
            throw new UnsupportedOperationException();
        }

        public <U> AsyncResult<U> map(Function<Object, U> mapper) {
            throw new UnsupportedOperationException();
        }

        public <V> AsyncResult<V> map(V value) {
            throw new UnsupportedOperationException();
        }
    };
    class DefaultCompleterTestFuture<T> implements Future<T> {

        boolean succeeded;

        boolean failed;

        T result;

        Throwable cause;

        public boolean isComplete() {
            throw new UnsupportedOperationException();
        }

        public Future<T> setHandler(Handler<AsyncResult<T>> handler) {
            throw new UnsupportedOperationException();
        }

        public void complete(T result) {
            if (!tryComplete(result)) {
                throw new IllegalStateException();
            }
        }

        public void complete() {
            if (!tryComplete()) {
                throw new IllegalStateException();
            }
        }

        public void fail(Throwable cause) {
            if (!tryFail(cause)) {
                throw new IllegalStateException();
            }
        }

        public void fail(String failureMessage) {
            if (!tryFail(failureMessage)) {
                throw new IllegalStateException();
            }
        }

        public boolean tryComplete(T result) {
            if (succeeded || failed) {
                return false;
            }
            succeeded = true;
            this.result = result;
            return true;
        }

        public boolean tryComplete() {
            throw new UnsupportedOperationException();
        }

        public boolean tryFail(Throwable cause) {
            if (succeeded || failed) {
                return false;
            }
            failed = true;
            this.cause = cause;
            return true;
        }

        public boolean tryFail(String failureMessage) {
            throw new UnsupportedOperationException();
        }

        public T result() {
            throw new UnsupportedOperationException();
        }

        public Throwable cause() {
            throw new UnsupportedOperationException();
        }

        public boolean succeeded() {
            throw new UnsupportedOperationException();
        }

        public boolean failed() {
            throw new UnsupportedOperationException();
        }

        public void handle(AsyncResult<T> asyncResult) {
            if (asyncResult.succeeded()) {
                complete(asyncResult.result());
            } else {
                fail(asyncResult.cause());
            }
        }
    }
    DefaultCompleterTestFuture<Object> successFuture = new DefaultCompleterTestFuture<>();
    successFuture.completer().handle(succeededAsyncResult);
    assertTrue(successFuture.succeeded);
    assertEquals(succeededAsyncResult.result(), successFuture.result);
    DefaultCompleterTestFuture<Object> failureFuture = new DefaultCompleterTestFuture<>();
    failureFuture.completer().handle(failedAsyncResult);
    assertTrue(failureFuture.failed);
    assertEquals(failedAsyncResult.cause(), failureFuture.cause);
}
Also used : Handler(io.vertx.core.Handler) BiFunction(java.util.function.BiFunction) Function(java.util.function.Function) NoStackTraceThrowable(io.vertx.core.impl.NoStackTraceThrowable) Future(io.vertx.core.Future) CompositeFuture(io.vertx.core.CompositeFuture) AsyncResult(io.vertx.core.AsyncResult) Test(org.junit.Test)

Example 78 with Handler

use of io.vertx.core.Handler in project vert.x by eclipse.

the class EventBusInterceptorTest method testExceptionInInterceptor.

@Test
public void testExceptionInInterceptor() {
    AtomicInteger cnt = new AtomicInteger();
    Handler<SendContext> eb1 = sc -> {
        cnt.incrementAndGet();
        vertx.runOnContext(v -> sc.next());
        throw new RuntimeException("foo");
    };
    Handler<SendContext> eb2 = sc -> {
        cnt.incrementAndGet();
        sc.next();
    };
    eb.addInterceptor(eb1).addInterceptor(eb2);
    eb.consumer("some-address", msg -> {
        assertEquals("armadillo", msg.body());
        assertEquals(2, cnt.get());
        testComplete();
    });
    eb.send("some-address", "armadillo");
    await();
}
Also used : EventBus(io.vertx.core.eventbus.EventBus) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) SendContext(io.vertx.core.eventbus.SendContext) Test(org.junit.Test) Handler(io.vertx.core.Handler) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) SendContext(io.vertx.core.eventbus.SendContext) Test(org.junit.Test)

Example 79 with Handler

use of io.vertx.core.Handler in project vert.x by eclipse.

the class VertxImpl method close.

@Override
public synchronized void close(Handler<AsyncResult<Void>> completionHandler) {
    if (closed || eventBus == null) {
        // Just call the handler directly since pools shutdown
        if (completionHandler != null) {
            completionHandler.handle(Future.succeededFuture());
        }
        return;
    }
    closed = true;
    closeHooks.run(ar -> {
        deploymentManager.undeployAll(ar1 -> {
            if (haManager() != null) {
                haManager().stop();
            }
            addressResolver.close(ar2 -> {
                eventBus.close(ar3 -> {
                    closeClusterManager(ar4 -> {
                        Set<HttpServer> httpServers = new HashSet<>(sharedHttpServers.values());
                        Set<NetServerBase> netServers = new HashSet<>(sharedNetServers.values());
                        sharedHttpServers.clear();
                        sharedNetServers.clear();
                        int serverCount = httpServers.size() + netServers.size();
                        AtomicInteger serverCloseCount = new AtomicInteger();
                        Handler<AsyncResult<Void>> serverCloseHandler = res -> {
                            if (res.failed()) {
                                log.error("Failure in shutting down server", res.cause());
                            }
                            if (serverCloseCount.incrementAndGet() == serverCount) {
                                deleteCacheDirAndShutdown(completionHandler);
                            }
                        };
                        for (HttpServer server : httpServers) {
                            server.close(serverCloseHandler);
                        }
                        for (NetServerBase server : netServers) {
                            server.close(serverCloseHandler);
                        }
                        if (serverCount == 0) {
                            deleteCacheDirAndShutdown(completionHandler);
                        }
                    });
                });
            });
        });
    });
}
Also used : HttpServerImpl(io.vertx.core.http.impl.HttpServerImpl) NetServerImpl(io.vertx.core.net.impl.NetServerImpl) HttpClientImpl(io.vertx.core.http.impl.HttpClientImpl) HttpServer(io.vertx.core.http.HttpServer) NetClientImpl(io.vertx.core.net.impl.NetClientImpl) DummyVertxMetrics(io.vertx.core.metrics.impl.DummyVertxMetrics) Context(io.vertx.core.Context) InetAddress(java.net.InetAddress) EventBus(io.vertx.core.eventbus.EventBus) WindowsFileSystem(io.vertx.core.file.impl.WindowsFileSystem) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) JsonObject(io.vertx.core.json.JsonObject) DatagramSocketOptions(io.vertx.core.datagram.DatagramSocketOptions) Logger(io.vertx.core.logging.Logger) ThreadFactory(java.util.concurrent.ThreadFactory) ClusterManager(io.vertx.core.spi.cluster.ClusterManager) VertxMetricsFactory(io.vertx.core.spi.VertxMetricsFactory) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) VertxOptions(io.vertx.core.VertxOptions) Set(java.util.Set) MetricsProvider(io.vertx.core.spi.metrics.MetricsProvider) EventLoop(io.netty.channel.EventLoop) ResourceLeakDetector(io.netty.util.ResourceLeakDetector) Future(io.vertx.core.Future) ServerID(io.vertx.core.net.impl.ServerID) InetSocketAddress(java.net.InetSocketAddress) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup) Executors(java.util.concurrent.Executors) NetClientOptions(io.vertx.core.net.NetClientOptions) DnsClient(io.vertx.core.dns.DnsClient) Objects(java.util.Objects) AddressResolverGroup(io.netty.resolver.AddressResolverGroup) NetServerOptions(io.vertx.core.net.NetServerOptions) PoolMetrics(io.vertx.core.spi.metrics.PoolMetrics) FileSystem(io.vertx.core.file.FileSystem) HttpClient(io.vertx.core.http.HttpClient) DatagramSocketImpl(io.vertx.core.datagram.impl.DatagramSocketImpl) VerticleFactory(io.vertx.core.spi.VerticleFactory) DatagramSocket(io.vertx.core.datagram.DatagramSocket) DnsClientImpl(io.vertx.core.dns.impl.DnsClientImpl) NetServerBase(io.vertx.core.net.impl.NetServerBase) HashMap(java.util.HashMap) LoggerFactory(io.vertx.core.logging.LoggerFactory) SharedData(io.vertx.core.shareddata.SharedData) VertxMetrics(io.vertx.core.spi.metrics.VertxMetrics) ArrayList(java.util.ArrayList) ConcurrentMap(java.util.concurrent.ConcurrentMap) TimeoutStream(io.vertx.core.TimeoutStream) HashSet(java.util.HashSet) ServiceHelper(io.vertx.core.ServiceHelper) SharedDataImpl(io.vertx.core.shareddata.impl.SharedDataImpl) AsyncResult(io.vertx.core.AsyncResult) HttpClientOptions(io.vertx.core.http.HttpClientOptions) NetClient(io.vertx.core.net.NetClient) Metrics(io.vertx.core.spi.metrics.Metrics) ExecutorService(java.util.concurrent.ExecutorService) EventBusImpl(io.vertx.core.eventbus.impl.EventBusImpl) Closeable(io.vertx.core.Closeable) EventLoopGroup(io.netty.channel.EventLoopGroup) Vertx(io.vertx.core.Vertx) GenericFutureListener(io.netty.util.concurrent.GenericFutureListener) Verticle(io.vertx.core.Verticle) File(java.io.File) FileSystemImpl(io.vertx.core.file.impl.FileSystemImpl) TimeUnit(java.util.concurrent.TimeUnit) AtomicLong(java.util.concurrent.atomic.AtomicLong) DeploymentOptions(io.vertx.core.DeploymentOptions) NetServer(io.vertx.core.net.NetServer) HttpServerOptions(io.vertx.core.http.HttpServerOptions) ClusteredEventBus(io.vertx.core.eventbus.impl.clustered.ClusteredEventBus) Handler(io.vertx.core.Handler) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) NetServerBase(io.vertx.core.net.impl.NetServerBase) HttpServer(io.vertx.core.http.HttpServer) AsyncResult(io.vertx.core.AsyncResult) HashSet(java.util.HashSet)

Example 80 with Handler

use of io.vertx.core.Handler in project vert.x by eclipse.

the class NetServerBase method listen.

public synchronized void listen(Handler<? super C> handler, int port, String host, Handler<AsyncResult<Void>> listenHandler) {
    if (handler == null) {
        throw new IllegalStateException("Set connect handler first");
    }
    if (listening) {
        throw new IllegalStateException("Listen already called");
    }
    listening = true;
    listenContext = vertx.getOrCreateContext();
    registeredHandler = handler;
    synchronized (vertx.sharedNetServers()) {
        // Will be updated on bind for a wildcard port
        this.actualPort = port;
        id = new ServerID(port, host);
        NetServerBase shared = vertx.sharedNetServers().get(id);
        if (shared == null || port == 0) {
            // Wildcard port will imply a new actual server each time
            serverChannelGroup = new DefaultChannelGroup("vertx-acceptor-channels", GlobalEventExecutor.INSTANCE);
            ServerBootstrap bootstrap = new ServerBootstrap();
            bootstrap.group(availableWorkers);
            bootstrap.channel(NioServerSocketChannel.class);
            sslHelper.validate(vertx);
            bootstrap.childHandler(new ChannelInitializer<Channel>() {

                @Override
                protected void initChannel(Channel ch) throws Exception {
                    if (isPaused()) {
                        ch.close();
                        return;
                    }
                    ChannelPipeline pipeline = ch.pipeline();
                    NetServerBase.this.initChannel(ch.pipeline());
                    pipeline.addLast("handler", new ServerHandler(ch));
                }
            });
            applyConnectionOptions(bootstrap);
            handlerManager.addHandler(handler, listenContext);
            try {
                bindFuture = AsyncResolveConnectHelper.doBind(vertx, port, host, bootstrap);
                bindFuture.addListener(res -> {
                    if (res.succeeded()) {
                        Channel ch = res.result();
                        log.trace("Net server listening on " + host + ":" + ch.localAddress());
                        NetServerBase.this.actualPort = ((InetSocketAddress) ch.localAddress()).getPort();
                        NetServerBase.this.id = new ServerID(NetServerBase.this.actualPort, id.host);
                        serverChannelGroup.add(ch);
                        vertx.sharedNetServers().put(id, NetServerBase.this);
                        metrics = vertx.metricsSPI().createMetrics(new SocketAddressImpl(id.port, id.host), options);
                    } else {
                        vertx.sharedNetServers().remove(id);
                    }
                });
            } catch (Throwable t) {
                // Make sure we send the exception back through the handler (if any)
                if (listenHandler != null) {
                    vertx.runOnContext(v -> listenHandler.handle(Future.failedFuture(t)));
                } else {
                    // No handler - log so user can see failure
                    log.error(t);
                }
                listening = false;
                return;
            }
            if (port != 0) {
                vertx.sharedNetServers().put(id, this);
            }
            actualServer = this;
        } else {
            // Server already exists with that host/port - we will use that
            actualServer = shared;
            this.actualPort = shared.actualPort();
            metrics = vertx.metricsSPI().createMetrics(new SocketAddressImpl(id.port, id.host), options);
            actualServer.handlerManager.addHandler(handler, listenContext);
        }
        // just add it to the future so it gets notified once the bind is complete
        actualServer.bindFuture.addListener(res -> {
            if (listenHandler != null) {
                AsyncResult<Void> ares;
                if (res.succeeded()) {
                    ares = Future.succeededFuture();
                } else {
                    listening = false;
                    ares = Future.failedFuture(res.cause());
                }
                listenContext.runOnContext(v -> listenHandler.handle(ares));
            } else if (res.failed()) {
                log.error("Failed to listen", res.cause());
                listening = false;
            }
        });
    }
    return;
}
Also used : DefaultChannelGroup(io.netty.channel.group.DefaultChannelGroup) ChannelOption(io.netty.channel.ChannelOption) ContextImpl(io.vertx.core.impl.ContextImpl) ByteBufAllocator(io.netty.buffer.ByteBufAllocator) DefaultChannelGroup(io.netty.channel.group.DefaultChannelGroup) TCPMetrics(io.vertx.core.spi.metrics.TCPMetrics) LoggerFactory(io.vertx.core.logging.LoggerFactory) GlobalEventExecutor(io.netty.util.concurrent.GlobalEventExecutor) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) FixedRecvByteBufAllocator(io.netty.channel.FixedRecvByteBufAllocator) Map(java.util.Map) AsyncResult(io.vertx.core.AsyncResult) Logger(io.vertx.core.logging.Logger) Metrics(io.vertx.core.spi.metrics.Metrics) Closeable(io.vertx.core.Closeable) ChannelGroup(io.netty.channel.group.ChannelGroup) VertxInternal(io.vertx.core.impl.VertxInternal) ChannelInitializer(io.netty.channel.ChannelInitializer) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) NioServerSocketChannel(io.netty.channel.socket.nio.NioServerSocketChannel) MetricsProvider(io.vertx.core.spi.metrics.MetricsProvider) ChannelPipeline(io.netty.channel.ChannelPipeline) EventLoop(io.netty.channel.EventLoop) Future(io.vertx.core.Future) InetSocketAddress(java.net.InetSocketAddress) Channel(io.netty.channel.Channel) NetServerOptions(io.vertx.core.net.NetServerOptions) SslHandler(io.netty.handler.ssl.SslHandler) ServerBootstrap(io.netty.bootstrap.ServerBootstrap) ChannelGroupFuture(io.netty.channel.group.ChannelGroupFuture) Handler(io.vertx.core.Handler) NioServerSocketChannel(io.netty.channel.socket.nio.NioServerSocketChannel) Channel(io.netty.channel.Channel) ServerBootstrap(io.netty.bootstrap.ServerBootstrap) ChannelPipeline(io.netty.channel.ChannelPipeline)

Aggregations

Handler (io.vertx.core.Handler)119 Test (org.junit.Test)78 Future (io.vertx.core.Future)67 Vertx (io.vertx.core.Vertx)59 AsyncResult (io.vertx.core.AsyncResult)57 Context (io.vertx.core.Context)52 Buffer (io.vertx.core.buffer.Buffer)48 Async (io.vertx.ext.unit.Async)41 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)39 Map (java.util.Map)38 TestContext (io.vertx.ext.unit.TestContext)37 VertxUnitRunner (io.vertx.ext.unit.junit.VertxUnitRunner)36 RunWith (org.junit.runner.RunWith)36 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)34 Collections (java.util.Collections)33 JsonObject (io.vertx.core.json.JsonObject)31 HttpURLConnection (java.net.HttpURLConnection)31 Before (org.junit.Before)31 StandardCharsets (java.nio.charset.StandardCharsets)29 TimeUnit (java.util.concurrent.TimeUnit)29