mardi 25 février 2020

Ways to configure a Netty EmbeddedChannel via Bootstrap?

In the Apache PLC4X project I am currently setting up a framework for integration tests. PLC4X 's Java drivers are heavily using Netty. Also have we built a large set of so-called "transports" which provide the Channels Netty uses for communication. One of these transports is the "TestTransport" which uses an EmbeddedChannel. I am struggling to make this transport work in Netty's Bootstrap mechanism. Sort of doesn't matter what I try, I am stuck. If I don't provide an EventLoop, Bootstrap complains that there's no EventLoop. If I get the EventLoop from the EmbeddedChannel by overriding the "init" method, the EmbeddedChannel complains that there is already an EventLoop configured.

Unfortunately in the core of Netty everything I would need to adjust is sort of "private", "package private" and "final". With more recent versions of Java, a lot of the evil reflection stuff is no longer possible.

Is there a way to configure a EmbeddedChannel with the Bootstrap mechanism, as I wouldn't want to tear apart the core of the project and switch to ChannelFactories just for this one feature ... and I wouldn't want to fork a lot of the Netty code just in order to get the job done.

Aucun commentaire:

Enregistrer un commentaire