Skip to content
Advertisement

‘Feeding’ a Netty 4 pipeline without a socket

I have a set of Netty 4 handlers that I normally chain on top of a ServerBootstrap using EpollEventLoopGroups. However the source of the data will not be a socket; instead I will read from / write to two in-memory buffers. Solution can be Linux-specific.

For now I add a ServerBootstrap to listen to a loopback port, to which I connect with a server and manually feed the data; but I wonder if I can do this without having to use a socket at all.

I considered writing a custom SocketChannel that extends LocalChannel but there are lot of details to consider and I feel out of my depth, honestly.

I have found this repository but it is for Netty 3, not 4: https://github.com/itm/netty-iostream

Advertisement

Answer

It sounds like you want to use EmbeddedChannel.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement