Last active
November 11, 2015 00:27
-
-
Save smaldini/31cb77baef4c6fe3ccef to your computer and use it in GitHub Desktop.
TBC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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