I have two systems I'd like to integrate, one which uses a completely in-house networking stack, and one (specifically Flazr) which uses Netty. I want to proxy the Flazr Netty-based RTMP stream over our in-house HTTP stack, to yield a system that speaks RTMPT.
To accomplish this, I need a Netty object that acts like a socket, but lets me do all of the "low-level" stuff myself - basically just wrapping the data in HTTP and passing it down our custom networking stack. In other words, I don't want Netty to manage any sockets for me - I want to insert my own stuff between the socket and Netty.
I suspect that the right way to go about this is to extend AbstractServerChannel and create a *Factory class, but I'm uncertain as to how the rest of Netty expects data to be flowing through the ServerChannel.
My custom ServerChannel need to be able to:
Notify Netty when a new client connects via our existing HTTP system
Push data up to Netty, when it arrives
Poll for new messages from Netty, at the request of a client
Clean up Netty state when the HTTP session times out (or the RTMP stream is closed cleanly)
Any pointers on how ServerChannel, ServerChannelFactory are to be implemented? I found the javadocs rather lacking in this area.
Some specific questions:
How should my implementation respond to "InterestOps"-type stuff?
Is ServerChannel.write what is called for messages that come all the way down the stack? What's up with the two different overloads?
How do I need to implement ServerChannel.(dis)connect?
Should I still do all of this stuff through ServerBootstrap, or is that too high-level for this stuff?
Thanks!
Before anyone asks: YES, I would love to replace our custom networking stack with a Netty-based one, but that's a large engineering task that I'd have a hard time justifying. Baby steps.