I'm using MINA 2.0.2 to implement a filter which adds encryption to UDP messages (basically a mini-DTLS). The problem I'm having is that I was hoping to be able to simply place a ProtocolCodecFilter on the filter chain to handle these messages, but when I send out one of these messages it gets processed by every other filter in the chain which is resulting in my internal handshake messages being encoded by the TextLineCodec I have later on in the chain.
The chain looks like this: DTLSFilter ---> DTLS Protocol Codec ---> TextLineCodec --> Logger When I initiate the handshake from the DTLSFilter, it writes the HandshakeMessage to the IoSession, which promptly passed it for processing through the chain in reverse order. This results in the TextLineCodec "encoding" my HandshakeMessage before my DTLS Protocol Codec gets a chance to. Is there a way I can simply disable the last N codecs during the handshake process and re-enable them afterwards? I noticed some discussions about a state machine based filter process in MINA 3.0 which sounds like it might be what I want, but thats not possible in 2.0 AFAIK. I also noticed that SslFilter isnt using this approach, so perhaps its not possible to have an out-of-band set of messages to perform the handshaking and I should just try to repeat what SslFilter does!
