How Do I Use An SSLServerSocket With ServerSocketChannel?



This seems to be a tough subject. Whenever I ask questions about sockets or
selectors or nonblocking io, it is difficult to get answers -- here or
elsewhere. Is there a reason for this? I've never had that kind of
trouble with other topics.

I have a program I've been using for port forwarding and I want to be able
to use SSL and encrypt the data. I'm using non-blocking modes for the
sockets by using Selector.select(). I've noticed that it is not possible
to create a ServerSocketChannel from an existing ServerSocket, so it seems
impossible to create one with an SSLServerSocket. Is there a way to do it?
If I create a ServerSocketChannel and use ServerSocketChannel.socket() to
get the ServerSocket, then use that socket to create an SSLServerSocket, is
there a way to use that SSLServerSocket with the ServerSocketChannel for
non-blocking IO?

Or will it work to use ServerSocketChannel.accept() to get a socket when the
first connection comes in use that Socket to create an SSLSocket? And if
so, how would I use the resulting socket in non-blocking mode with a
SocketChannel?

Thanks for any help or links!

Hal

.