@Test public void sendFileAsync4096() throws IOException, URISyntaxException { doTestSendFileAsync((req, resp) -> resp.sendByteArray(req.receive() .aggregate() .asByteArray()), 4096, null); }
@Test public void sendFileAsync1024() throws IOException, URISyntaxException { doTestSendFileAsync((req, resp) -> resp.sendByteArray(req.receive() .aggregate() .asByteArray()), 1024, null); }
@Test @Ignore public void startContentServer() { Random random = new Random(0); byte[] content = new byte[1024 * 10]; random.nextBytes(content); HttpServer server = HttpServer.create() .port(CONTENT_SERVER_PORT) .tcpConfiguration(tcpServer -> tcpServer.host("0.0.0.0") .option(ChannelOption.SO_LINGER, -1)); server.route(routes -> routes.get("/**", (req, res) -> res.header("Content-length", String.valueOf(content.length)) .header("Content-type", "application/octet-stream") .header("Connection", "Close") .sendByteArray(Flux.just(content)))) .wiretap(true) .bindNow(); }
routes.get("/target", (req, res) -> req.receive() .thenMany(res.sendByteArray(Flux.just(content) .delayElements(Duration.ofMillis(100)))))) .bindNow();
routes.get("/target", (req, res) -> req.receive() .thenMany(res.sendByteArray(Flux.just(content) .delayElements(Duration.ofMillis(100)))))) .bindNow();