How to force the JVM to use this default IP address?

Is there a way to force the JVM to use a specific source IP when using the standard built-in java.xml.SOAPConnectionFactory? Apparently, by default, HttpSOAPConnection (sun private API) objects are created, which then uses the HttpURLConnection under the hood. I cannot find any system property for HttpURLConnection to use the specific source IP. There is a similar question at https://stackoverflow.com/a/1362868/ ... but I hope someone else will have more information or a trick that I can use.

+4
source share
1 answer

The Http client from Apache Commons (http://hc.apache.org/httpcomponents-client-ga/) supports this:

" ConnRoutePNames.LOCAL_ADDRESS = 'http.route.local-address' : defines the local address that should be used by all route planners by default. On computers with multiple network interfaces, this parameter can be used to select the network interface from which the connection is made. This the parameter expects a java.net.InetAddress type value. If this parameter is not set, the local address will be used automatically by default. "

+3
source

Source: https://habr.com/ru/post/1342863/


All Articles