Search in sources :

Example 16 with HttpServerResponse

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

the class HttpTest method testDeliverPausedBufferWhenResume.

@Test
public void testDeliverPausedBufferWhenResume() throws Exception {
    Buffer data = TestUtils.randomBuffer(20);
    int num = 10;
    waitFor(num);
    List<CompletableFuture<Void>> resumes = Collections.synchronizedList(new ArrayList<>());
    for (int i = 0; i < num; i++) {
        resumes.add(new CompletableFuture<>());
    }
    server.requestHandler(req -> {
        int idx = Integer.parseInt(req.path().substring(1));
        HttpServerResponse resp = req.response();
        resumes.get(idx).thenAccept(v -> {
            resp.end();
        });
        resp.setChunked(true).write(data);
    });
    startServer();
    client.close();
    client = vertx.createHttpClient(createBaseClientOptions().setMaxPoolSize(1).setKeepAlive(true));
    for (int i = 0; i < num; i++) {
        int idx = i;
        client.request(HttpMethod.GET, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, "/" + i, resp -> {
            Buffer body = Buffer.buffer();
            resp.handler(buff -> {
                resumes.get(idx).complete(null);
                body.appendBuffer(buff);
            });
            resp.endHandler(v -> {
                assertEquals(data, body);
                complete();
            });
            resp.pause();
            vertx.setTimer(10, id -> {
                resp.resume();
            });
        }).end();
    }
    await();
}
Also used : Buffer(io.vertx.core.buffer.Buffer) VertxException(io.vertx.core.VertxException) MultiMap(io.vertx.core.MultiMap) TimeoutException(java.util.concurrent.TimeoutException) Context(io.vertx.core.Context) InetAddress(java.net.InetAddress) HttpFrame(io.vertx.core.http.HttpFrame) HttpVersion(io.vertx.core.http.HttpVersion) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) TestLoggerFactory(io.vertx.test.netty.TestLoggerFactory) HttpHeaders(io.vertx.core.http.HttpHeaders) HttpResponseStatus(io.netty.handler.codec.http.HttpResponseStatus) UUID(java.util.UUID) Future(io.vertx.core.Future) FileNotFoundException(java.io.FileNotFoundException) Nullable(io.vertx.codegen.annotations.Nullable) CountDownLatch(java.util.concurrent.CountDownLatch) List(java.util.List) Buffer(io.vertx.core.buffer.Buffer) DefaultHttpHeaders(io.netty.handler.codec.http.DefaultHttpHeaders) HttpServerResponse(io.vertx.core.http.HttpServerResponse) AbstractVerticle(io.vertx.core.AbstractVerticle) WorkerContext(io.vertx.core.impl.WorkerContext) UnsupportedEncodingException(java.io.UnsupportedEncodingException) HttpClient(io.vertx.core.http.HttpClient) NetSocket(io.vertx.core.net.NetSocket) IntStream(java.util.stream.IntStream) HeadersAdaptor(io.vertx.core.http.impl.HeadersAdaptor) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) TestUtils.assertNullPointerException(io.vertx.test.core.TestUtils.assertNullPointerException) AtomicReference(java.util.concurrent.atomic.AtomicReference) Function(java.util.function.Function) ArrayList(java.util.ArrayList) HttpClientRequest(io.vertx.core.http.HttpClientRequest) HttpClientResponse(io.vertx.core.http.HttpClientResponse) OutputStreamWriter(java.io.OutputStreamWriter) Assume(org.junit.Assume) AsyncResult(io.vertx.core.AsyncResult) HttpClientOptions(io.vertx.core.http.HttpClientOptions) HttpConnection(io.vertx.core.http.HttpConnection) BufferedWriter(java.io.BufferedWriter) Vertx(io.vertx.core.Vertx) FileOutputStream(java.io.FileOutputStream) Test(org.junit.Test) File(java.io.File) TimeUnit(java.util.concurrent.TimeUnit) Consumer(java.util.function.Consumer) EventLoopContext(io.vertx.core.impl.EventLoopContext) URLEncoder(java.net.URLEncoder) Rule(org.junit.Rule) DeploymentOptions(io.vertx.core.DeploymentOptions) HttpMethod(io.vertx.core.http.HttpMethod) HttpServerOptions(io.vertx.core.http.HttpServerOptions) InternalLoggerFactory(io.netty.util.internal.logging.InternalLoggerFactory) Handler(io.vertx.core.Handler) Collections(java.util.Collections) TestUtils.assertIllegalStateException(io.vertx.test.core.TestUtils.assertIllegalStateException) TemporaryFolder(org.junit.rules.TemporaryFolder) TestUtils.assertIllegalArgumentException(io.vertx.test.core.TestUtils.assertIllegalArgumentException) CompletableFuture(java.util.concurrent.CompletableFuture) HttpServerResponse(io.vertx.core.http.HttpServerResponse) Test(org.junit.Test)

Example 17 with HttpServerResponse

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

the class Http2ServerTest method test100ContinueHandledAutomatically.

@Test
public void test100ContinueHandledAutomatically() throws Exception {
    server.close();
    server = vertx.createHttpServer(serverOptions.setHandle100ContinueAutomatically(true));
    server.requestHandler(req -> {
        HttpServerResponse resp = req.response();
        req.bodyHandler(body -> {
            assertEquals("the-body", body.toString());
            resp.putHeader("wibble", "wibble-value").end();
        });
    });
    test100Continue();
}
Also used : HttpServerResponse(io.vertx.core.http.HttpServerResponse) Test(org.junit.Test)

Example 18 with HttpServerResponse

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

the class HttpTest method testUseResponseAfterComplete.

@Test
public void testUseResponseAfterComplete() {
    server.requestHandler(req -> {
        Buffer buff = Buffer.buffer();
        HttpServerResponse resp = req.response();
        assertFalse(resp.ended());
        resp.end();
        assertTrue(resp.ended());
        assertIllegalStateException(() -> resp.drainHandler(noOpHandler()));
        assertIllegalStateException(() -> resp.end());
        assertIllegalStateException(() -> resp.end("foo"));
        assertIllegalStateException(() -> resp.end(buff));
        assertIllegalStateException(() -> resp.end("foo", "UTF-8"));
        assertIllegalStateException(() -> resp.exceptionHandler(noOpHandler()));
        assertIllegalStateException(() -> resp.setChunked(false));
        assertIllegalStateException(() -> resp.setWriteQueueMaxSize(123));
        assertIllegalStateException(() -> resp.write(buff));
        assertIllegalStateException(() -> resp.write("foo"));
        assertIllegalStateException(() -> resp.write("foo", "UTF-8"));
        assertIllegalStateException(() -> resp.write(buff));
        assertIllegalStateException(() -> resp.writeQueueFull());
        assertIllegalStateException(() -> resp.sendFile("asokdasokd"));
        testComplete();
    });
    server.listen(onSuccess(s -> {
        client.request(HttpMethod.GET, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, DEFAULT_TEST_URI, noOpHandler()).end();
    }));
    await();
}
Also used : Buffer(io.vertx.core.buffer.Buffer) VertxException(io.vertx.core.VertxException) MultiMap(io.vertx.core.MultiMap) TimeoutException(java.util.concurrent.TimeoutException) Context(io.vertx.core.Context) InetAddress(java.net.InetAddress) HttpFrame(io.vertx.core.http.HttpFrame) HttpVersion(io.vertx.core.http.HttpVersion) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) TestLoggerFactory(io.vertx.test.netty.TestLoggerFactory) HttpHeaders(io.vertx.core.http.HttpHeaders) HttpResponseStatus(io.netty.handler.codec.http.HttpResponseStatus) UUID(java.util.UUID) Future(io.vertx.core.Future) FileNotFoundException(java.io.FileNotFoundException) Nullable(io.vertx.codegen.annotations.Nullable) CountDownLatch(java.util.concurrent.CountDownLatch) List(java.util.List) Buffer(io.vertx.core.buffer.Buffer) DefaultHttpHeaders(io.netty.handler.codec.http.DefaultHttpHeaders) HttpServerResponse(io.vertx.core.http.HttpServerResponse) AbstractVerticle(io.vertx.core.AbstractVerticle) WorkerContext(io.vertx.core.impl.WorkerContext) UnsupportedEncodingException(java.io.UnsupportedEncodingException) HttpClient(io.vertx.core.http.HttpClient) NetSocket(io.vertx.core.net.NetSocket) IntStream(java.util.stream.IntStream) HeadersAdaptor(io.vertx.core.http.impl.HeadersAdaptor) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) TestUtils.assertNullPointerException(io.vertx.test.core.TestUtils.assertNullPointerException) AtomicReference(java.util.concurrent.atomic.AtomicReference) Function(java.util.function.Function) ArrayList(java.util.ArrayList) HttpClientRequest(io.vertx.core.http.HttpClientRequest) HttpClientResponse(io.vertx.core.http.HttpClientResponse) OutputStreamWriter(java.io.OutputStreamWriter) Assume(org.junit.Assume) AsyncResult(io.vertx.core.AsyncResult) HttpClientOptions(io.vertx.core.http.HttpClientOptions) HttpConnection(io.vertx.core.http.HttpConnection) BufferedWriter(java.io.BufferedWriter) Vertx(io.vertx.core.Vertx) FileOutputStream(java.io.FileOutputStream) Test(org.junit.Test) File(java.io.File) TimeUnit(java.util.concurrent.TimeUnit) Consumer(java.util.function.Consumer) EventLoopContext(io.vertx.core.impl.EventLoopContext) URLEncoder(java.net.URLEncoder) Rule(org.junit.Rule) DeploymentOptions(io.vertx.core.DeploymentOptions) HttpMethod(io.vertx.core.http.HttpMethod) HttpServerOptions(io.vertx.core.http.HttpServerOptions) InternalLoggerFactory(io.netty.util.internal.logging.InternalLoggerFactory) Handler(io.vertx.core.Handler) Collections(java.util.Collections) TestUtils.assertIllegalStateException(io.vertx.test.core.TestUtils.assertIllegalStateException) TemporaryFolder(org.junit.rules.TemporaryFolder) TestUtils.assertIllegalArgumentException(io.vertx.test.core.TestUtils.assertIllegalArgumentException) HttpServerResponse(io.vertx.core.http.HttpServerResponse) Test(org.junit.Test)

Example 19 with HttpServerResponse

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

the class Http2ServerTest method testGet.

@Test
public void testGet() throws Exception {
    String expected = TestUtils.randomAlphaString(1000);
    AtomicBoolean requestEnded = new AtomicBoolean();
    Context ctx = vertx.getOrCreateContext();
    server.requestHandler(req -> {
        assertOnIOContext(ctx);
        req.endHandler(v -> {
            assertOnIOContext(ctx);
            requestEnded.set(true);
        });
        HttpServerResponse resp = req.response();
        assertEquals(HttpMethod.GET, req.method());
        assertEquals(DEFAULT_HTTPS_HOST_AND_PORT, req.host());
        assertEquals("/", req.path());
        assertEquals(DEFAULT_HTTPS_HOST_AND_PORT, req.getHeader(":authority"));
        assertTrue(req.isSSL());
        assertEquals("https", req.getHeader(":scheme"));
        assertEquals("/", req.getHeader(":path"));
        assertEquals("GET", req.getHeader(":method"));
        assertEquals("foo_request_value", req.getHeader("Foo_request"));
        assertEquals("bar_request_value", req.getHeader("bar_request"));
        assertEquals(2, req.headers().getAll("juu_request").size());
        assertEquals("juu_request_value_1", req.headers().getAll("juu_request").get(0));
        assertEquals("juu_request_value_2", req.headers().getAll("juu_request").get(1));
        assertEquals(Collections.singletonList("cookie_1; cookie_2; cookie_3"), req.headers().getAll("cookie"));
        resp.putHeader("content-type", "text/plain");
        resp.putHeader("Foo_response", "foo_response_value");
        resp.putHeader("bar_response", "bar_response_value");
        resp.putHeader("juu_response", (List<String>) Arrays.asList("juu_response_value_1", "juu_response_value_2"));
        resp.end(expected);
    });
    startServer(ctx);
    TestClient client = new TestClient();
    ChannelFuture fut = client.connect(DEFAULT_HTTPS_PORT, DEFAULT_HTTPS_HOST, request -> {
        int id = request.nextStreamId();
        request.decoder.frameListener(new Http2EventAdapter() {

            @Override
            public void onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int streamDependency, short weight, boolean exclusive, int padding, boolean endStream) throws Http2Exception {
                vertx.runOnContext(v -> {
                    assertEquals(id, streamId);
                    assertEquals("200", headers.status().toString());
                    assertEquals("text/plain", headers.get("content-type").toString());
                    assertEquals("foo_response_value", headers.get("foo_response").toString());
                    assertEquals("bar_response_value", headers.get("bar_response").toString());
                    assertEquals(2, headers.getAll("juu_response").size());
                    assertEquals("juu_response_value_1", headers.getAll("juu_response").get(0).toString());
                    assertEquals("juu_response_value_2", headers.getAll("juu_response").get(1).toString());
                    assertFalse(endStream);
                });
            }

            @Override
            public int onDataRead(ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding, boolean endOfStream) throws Http2Exception {
                String actual = data.toString(StandardCharsets.UTF_8);
                vertx.runOnContext(v -> {
                    assertEquals(id, streamId);
                    assertEquals(expected, actual);
                    assertTrue(endOfStream);
                    testComplete();
                });
                return super.onDataRead(ctx, streamId, data, padding, endOfStream);
            }
        });
        Http2Headers headers = GET("/").authority(DEFAULT_HTTPS_HOST_AND_PORT);
        headers.set("foo_request", "foo_request_value");
        headers.set("bar_request", "bar_request_value");
        headers.set("juu_request", "juu_request_value_1", "juu_request_value_2");
        headers.set("cookie", Arrays.asList("cookie_1", "cookie_2", "cookie_3"));
        request.encoder.writeHeaders(request.context, id, headers, 0, true, request.context.newPromise());
        request.context.flush();
    });
    fut.sync();
    await();
}
Also used : Context(io.vertx.core.Context) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) ChannelFuture(io.netty.channel.ChannelFuture) 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) Http2Exception(io.netty.handler.codec.http2.Http2Exception) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) ByteBuf(io.netty.buffer.ByteBuf) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Http2Headers(io.netty.handler.codec.http2.Http2Headers) DefaultHttp2Headers(io.netty.handler.codec.http2.DefaultHttp2Headers) HttpServerResponse(io.vertx.core.http.HttpServerResponse) Http2EventAdapter(io.netty.handler.codec.http2.Http2EventAdapter) Test(org.junit.Test)

Example 20 with HttpServerResponse

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

the class Http2ServerTest method testRequestResponseLifecycle.

@Test
public void testRequestResponseLifecycle() throws Exception {
    waitFor(2);
    server.requestHandler(req -> {
        req.endHandler(v -> {
            assertIllegalStateException(() -> req.setExpectMultipart(false));
            assertIllegalStateException(() -> req.handler(buf -> {
            }));
            assertIllegalStateException(() -> req.uploadHandler(upload -> {
            }));
            assertIllegalStateException(() -> req.endHandler(v2 -> {
            }));
            complete();
        });
        HttpServerResponse resp = req.response();
        resp.setChunked(true).write(Buffer.buffer("whatever"));
        assertTrue(resp.headWritten());
        assertIllegalStateException(() -> resp.setChunked(false));
        assertIllegalStateException(() -> resp.setStatusCode(100));
        assertIllegalStateException(() -> resp.setStatusMessage("whatever"));
        assertIllegalStateException(() -> resp.putHeader("a", "b"));
        assertIllegalStateException(() -> resp.putHeader("a", (CharSequence) "b"));
        assertIllegalStateException(() -> resp.putHeader("a", (Iterable<String>) Arrays.asList("a", "b")));
        assertIllegalStateException(() -> resp.putHeader("a", (Arrays.<CharSequence>asList("a", "b"))));
        assertIllegalStateException(resp::writeContinue);
        resp.end();
        assertIllegalStateException(() -> resp.write("a"));
        assertIllegalStateException(() -> resp.write("a", "UTF-8"));
        assertIllegalStateException(() -> resp.write(Buffer.buffer("a")));
        assertIllegalStateException(resp::end);
        assertIllegalStateException(() -> resp.end("a"));
        assertIllegalStateException(() -> resp.end("a", "UTF-8"));
        assertIllegalStateException(() -> resp.end(Buffer.buffer("a")));
        assertIllegalStateException(() -> resp.sendFile("the-file.txt"));
        assertIllegalStateException(() -> resp.reset(0));
        assertIllegalStateException(() -> resp.closeHandler(v -> {
        }));
        assertIllegalStateException(() -> resp.endHandler(v -> {
        }));
        assertIllegalStateException(() -> resp.drainHandler(v -> {
        }));
        assertIllegalStateException(() -> resp.exceptionHandler(err -> {
        }));
        assertIllegalStateException(resp::writeQueueFull);
        assertIllegalStateException(() -> resp.setWriteQueueMaxSize(100));
        assertIllegalStateException(() -> resp.putTrailer("a", "b"));
        assertIllegalStateException(() -> resp.putTrailer("a", (CharSequence) "b"));
        assertIllegalStateException(() -> resp.putTrailer("a", (Iterable<String>) Arrays.asList("a", "b")));
        assertIllegalStateException(() -> resp.putTrailer("a", (Arrays.<CharSequence>asList("a", "b"))));
        assertIllegalStateException(() -> resp.push(HttpMethod.GET, "/whatever", ar -> {
        }));
        complete();
    });
    startServer();
    TestClient client = new TestClient();
    ChannelFuture fut = client.connect(DEFAULT_HTTPS_PORT, DEFAULT_HTTPS_HOST, request -> {
        int id = request.nextStreamId();
        request.encoder.writeHeaders(request.context, id, GET("/"), 0, true, request.context.newPromise());
        request.context.flush();
    });
    fut.sync();
    await();
}
Also used : 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) HttpServerResponse(io.vertx.core.http.HttpServerResponse) Test(org.junit.Test)

Aggregations

HttpServerResponse (io.vertx.core.http.HttpServerResponse)37 Test (org.junit.Test)29 Buffer (io.vertx.core.buffer.Buffer)20 HttpClientRequest (io.vertx.core.http.HttpClientRequest)20 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)19 HttpClientOptions (io.vertx.core.http.HttpClientOptions)17 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)16 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)16 HttpMethod (io.vertx.core.http.HttpMethod)15 HttpServerOptions (io.vertx.core.http.HttpServerOptions)15 NetSocket (io.vertx.core.net.NetSocket)14 TimeUnit (java.util.concurrent.TimeUnit)14 AtomicReference (java.util.concurrent.atomic.AtomicReference)14 ChannelFuture (io.netty.channel.ChannelFuture)13 HttpConnection (io.vertx.core.http.HttpConnection)13 HttpVersion (io.vertx.core.http.HttpVersion)13 TestUtils.assertIllegalStateException (io.vertx.test.core.TestUtils.assertIllegalStateException)13 ArrayList (java.util.ArrayList)13 Collections (java.util.Collections)13 List (java.util.List)13