Skip to content

Instantly share code, notes, and snippets.

@smaldini
Last active November 11, 2015 00:27
Show Gist options
  • Save smaldini/31cb77baef4c6fe3ccef to your computer and use it in GitHub Desktop.
Save smaldini/31cb77baef4c6fe3ccef to your computer and use it in GitHub Desktop.
TBC
//Create an HTTP Server on 8080
ReactiveNet.httpServer(8080)
//on HTTP Post matching /hello URI
.post("/hello", httpChannel ->
//echo input to output and close on flush
httpChannel.writeWith(httpChannel.input())
)
//Make sure server is ready before starting client
.startAndAwait();
//Create an HTTP client connecting on started server
ReactiveNet.httpClient()
//Prepare Post request handling
.post("http://localhost:8080/hello", httpChannel ->
httpChannel.header("foo","bar").writeWith(Publishers.just(Buffer.wrap("World")))
)
.subscribe(httpChannel ->
httpChannel.input().subscribe(Subscribers.unbounded(Buffer::asString))
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment