I am going to be writing a Java application that uses Selector to multiplex socket channels. I am going to have a configuration where communications are encrypted with SSL and another where SSL is not used. I have not used the SSLEngine before and integrating it with a Selector seems... difficult to get right.
How I can cleanly handle both configurations? Has anyone done this? A code sample would be great.
NOTE: I have already seen these articles.
http://archive.oreilly.com/pub/a/onjava/2004/11/03/ssl-nio.html https://jfarcand.wordpress.com/2006/09/21/tricks-and-tips-with-nio-part-v-ssl-and-nio-friend-or-foe/ http://docs.oracle.com/javase/7/docs/technotes/guides/security/jsse/JSSERefGuide.html#SSLENG