A client for
InterceptingServer, which follows a simple text based, new line delimited message protocol.
The client expects a "Hello" as the first message and then the echo of what it sends to the server. This client,
sends a "Hello World" to the server and expects an echo.
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 (
InterceptingServer)
on an ephemeral port, send a "Hello World!" message to the server and print the response.
If you want to see how
InterceptingServer work, you can run
InterceptingServer by yourself and then
pass the port on which the server started to this class as a program argument:
java io.reactivex.netty.examples.tcp.interceptors.simple.InterceptingClient [server port]
Existing TCP server
You can also use this client to connect to an already running TCP server (different than
InterceptingServer) by passing the port and host of the existing server similar to the case above:
java io.reactivex.netty.examples.tcp.interceptors.simple.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.