Is it possible to use a single clientsocketbootstrap to connect to multiple hosts? Also, does each connection get its own pipeline, so one connection can have a certain set of handlers and another its own set of handlers?
bootstrap.connect(serverA, portA);
then, later, after serverA is connected,
bootstrap.connect(serverB, portB);
Yes you can reuse the client bootstrap without a problem. If you specify a ChannelPipelineFactory each new channel will get its own ChannelPipeline. If you want to have different settings for different clients you may just create one client bootstrap per connection. This works out very well as the bootstrap is really light-weight.
Take a look at this answer. It shows the code to use same client bootstrap with different handlers, creating multiple connections.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With