diff options
Diffstat (limited to 'java/src/IceInternal/Instance.java')
-rw-r--r-- | java/src/IceInternal/Instance.java | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/java/src/IceInternal/Instance.java b/java/src/IceInternal/Instance.java index ac49c4cd576..bd20af30ff6 100644 --- a/java/src/IceInternal/Instance.java +++ b/java/src/IceInternal/Instance.java @@ -189,6 +189,12 @@ public final class Instance return _preferIPv6; } + public NetworkProxy + networkProxy() + { + return _networkProxy; + } + public synchronized ThreadPool clientThreadPool() { @@ -760,8 +766,17 @@ public final class Instance _proxyFactory = new ProxyFactory(this); + final String proxyHost = _initData.properties.getProperty("Ice.SOCKSProxyHost"); + int defaultIPv6 = 1; // IPv6 enabled by default. + if(proxyHost.length() > 0) + { + final int proxyPort = _initData.properties.getPropertyAsIntWithDefault("Ice.SOCKSProxyPort", 1080); + _networkProxy = new SOCKSNetworkProxy(proxyHost, proxyPort); + defaultIPv6 = 0; // IPv6 is not supported with SOCKS + } + boolean ipv4 = _initData.properties.getPropertyAsIntWithDefault("Ice.IPv4", 1) > 0; - boolean ipv6 = _initData.properties.getPropertyAsIntWithDefault("Ice.IPv6", 1) > 0; + boolean ipv6 = _initData.properties.getPropertyAsIntWithDefault("Ice.IPv6", defaultIPv6) > 0; if(!ipv4 && !ipv6) { throw new Ice.InitializationException("Both IPV4 and IPv6 support cannot be disabled."); @@ -779,6 +794,12 @@ public final class Instance _protocolSupport = Network.EnableIPv6; } _preferIPv6 = _initData.properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0; + + if(ipv6 && _networkProxy instanceof SOCKSNetworkProxy) + { + throw new Ice.InitializationException("IPv6 is not supported with SOCKS4 proxies"); + } + _endpointFactoryManager = new EndpointFactoryManager(this); EndpointFactory tcpEndpointFactory = new TcpEndpointFactory(this); _endpointFactoryManager.add(tcpEndpointFactory); @@ -1204,6 +1225,7 @@ public final class Instance private ObjectAdapterFactory _objectAdapterFactory; private int _protocolSupport; private boolean _preferIPv6; + private NetworkProxy _networkProxy; private ThreadPool _clientThreadPool; private ThreadPool _serverThreadPool; private EndpointHostResolver _endpointHostResolver; |