Re: Subclassing SSLSocket



Thank you for your answers!

I realize that I should delegate instead of subclassing, and indeed,
implementing a HandshakeCompletionListener would suffice.
However, this still gives me a problematic situation:

I am not actually creating SSLSocketFactory / SSLSocket objects
myself, but I would like to hook my own factories / sockets into the
JSSE system, and I'm trying to do this using the
"ssl.SocketFactory.provider" security property. My socketfactory would
simply delegate its tasks to the default socketfactory, but add a
HandshakeCompletionListener to the created socket before returning it.

Now, I believe this is not possible since:
1. The "default" SSLSocketFactory implementation can be accessed
through the ssl.SocketFactory.provider property
2. If I override the ssl.SocketFactory.provider property, how do I
create a SSLSocketFactory within my custom Factory?

First retrieving the default SSLSocketFactory by calling
SSLSocketFactory.getDefault() and then creating my custom class does
not work: after the default socketfactory has been created, changing
the ssl.SocketFactory.provider property has no effect.


How can I solve this?

Thanks,
Robert

.