Install Standard SocketFactory

I recently migrated my web services from Axis to CXF (2.1). It seems that while Axis needs the “axis.socketSecureFactory” set, CXF captures the default value. How to set the default SocketFactory in Java to my own implementation (e.g. property)?

What I need not to do is set the SocketFactory properties by default, for example, set the property for my trust, keystore and passwords.

+4
source share
2 answers

According to the OpenJDK7 source code for javax.net.SocketFactory , the Sun JVM is hardcoded to return javax.net.DefaultSocketFactory for getDefault();

Edit: However, by default, SSLSocketFactory can be set using the ssl.SocketFactory.provider security ssl.SocketFactory.provider

+5
source

If we are talking about standard sockets, then Socket.setSocketImplFactory(SocketImplFactory) used to change the factory for regular sockets and ServerSocket.setSocketFactory(SocketImplFactory) for server sockets.

If you use them, then pay attention to the fact that you can install these factories only once.

Note that the default java socket implementation uses SocksSocketImpl (the package visibility class in java.net) if it detects that the factory is null if you want the factory to be able to switch the package to standard java.

+7
source

All Articles