I use netty. In may application i process inсoming packets, but i need send parsed packet in other server and should return to the incoming flow of the result of processing the package third-party server; How i can open new connection inside server hadler for send packet to third-party server and read result?
Share
The same way you would write a client with netty.
Netty client example: http://static.netty.io/3.6/guide/#start.9
You’d need to use the
ClientBootstrapto set up a new bootstrap, create a pipeline factory, handlers, etc, etc.In all honestly, that’s probably a bit overkill unless you really need it to be async, which is sounds like you don’t. If it’s just a REST service or something similar you need to access, I’d just use a plaid old
HttpUrlConnectionand get what you need synchronously.