I have a kind of Http-Gateway app, which acts as an http client towards servers outside our local network.
There is going to be a network configuration upgrade, and I’m going to have problems because:
– there are multiple network cards on client machine
– firewall/nat rules use hardwired ip addresses
If I could programmatically force HttpUrlConnection object to use a specific ip address, I would be ok. But I’m afraid it can’t be done.
Am I right? If not, which version of JRE supports it?
Other possible solutions, preferably ones which don’t involve rewriting everything from scratch?
The simpler the better: I know, there is Apache HttpClient, or I could use Sockets…
Thanks
I can see no good solution but have two poor possibilities:
Proxy the connections locally:
Register a custom
URLStreamHandlerFactorywithjava.net.URL. WheneveropenConnection()is called on theURLit would be handled by this registered custom factory, giving you control over details of the socket connection. Either use Apache’s implementation or roll your own?