return Streams.just(Buffer.wrap(response.toString()));
}));
};
}
ReactorChannelHandler<Buffer, Buffer, HttpChannel<Buffer, Buffer>> alwaysBlocksHandler() {
return channel -> {
return channel.writeWith(channel.log("channel-post").take(1).map(input -> Buffer.wrap("hello" + input.asString())).log("channel-post-replying"));
};
}
@Test(enabled = false)
public void testGetInLoop() throws InterruptedException, IOException, HttpException {
for (int i = 0; i < 10; i++) {
System.out.println("======================================================================================================");
get(String.format("/get/joe-%d", i), httpServer.getListenAddress());
}
}
@Test(enabled = false)
public void testPostWithProcessor() throws InterruptedException, IOException, HttpException {
/* This post always returns */
System.out.println("======================================================================================================");
post("/stream-post", URLEncoder.encode("pete", "UTF8"), httpServer.getListenAddress());
}
@Test
public void testPostInLoop() throws InterruptedException, IOException, HttpException {
/* These posts will eventually block after 1-N attempts */
for (int i = 0; i < 5; i++) {
System.out.println("======================================================================================================");
post("/stream-post", URLEncoder.encode(String.format("sam-%d", i), "UTF8"), httpServer.getListenAddress());
}
}
@Test(enabled = false)
public void testChannelHandler() throws InterruptedException, IOException, HttpException {
System.out.println("======================================================================================================");
post("/channel-post", URLEncoder.encode("charlie", "UTF8"), httpServer.getListenAddress());
}
@Test(enabled = false)
public void testChannelPostAlwaysBlocks() throws InterruptedException, IOException, HttpException {
/* Post on this handler always blocks and never returns */
System.out.println("======================================================================================================");
post("/channel-post-blocks", URLEncoder.encode("john", "UTF8"), httpServer.getListenAddress());