A client for
TransformingInterceptorsServer, which follows a simple text based, new line delimited
message protocol. It sends an integer as the request payload and expects two integers separated by new lines, as the
response payload.
There are three ways of running this example:
Default
The default way is to just run this class with no arguments, which will start a server
(
TransformingInterceptorsServer)
on an ephemeral port, send an integer to the server and print the response.
If you want to see how
TransformingInterceptorsServer work, you can run
TransformingInterceptorsServer by yourself and then
pass the port on which the server started to this class as a program argument:
java io.reactivex.netty.examples.http.interceptors.transformation.InterceptingClient [server port]
Existing HTTP server
You can also use this client to send a POST request "/ints" to an existing HTTP server (different than
TransformingInterceptorsServer) by passing the port and host of the existing server similar to the case above::
java io.reactivex.netty.examples.http.interceptors.transformation.InterceptingClient [server port] [server host]
If the server host is omitted from the above, it defaults to "127.0.0.1"
In all the above usages, this client will print the response received from the server.