I'm trying to create a Camel/Netty TCP client that works as follows:
- connect to
remoteserver:1234
- send a handshake message (pretend it's the string "handshake")
- leave this connection open
- wait/listen for TCP messages from the server and reply to them
Here's a simple hello-world server.
from("netty:tcp://localhost:8001?textline=true&sync=true") //
.process((exchange) -> {
String msgReceived = exchange.getIn().getBody(String.class);
exchange.getOut().setBody("hello " + msgReceived);
});
I can open a command line TCP connection to this, type in text, and receive my hello-world reply.
Now how do I structure an analogous client that likewise just waits for messages and replies?