summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/PropertyNames.xml2
-rw-r--r--cpp/src/Ice/PropertyNames.cpp4
-rw-r--r--cpp/src/Ice/PropertyNames.h2
-rw-r--r--cpp/src/slice2confluence/ConfluenceOutput.cpp2
-rwxr-xr-xcs/allTests.py4
-rw-r--r--cs/src/Ice/EndpointHostResolver.cs51
-rw-r--r--cs/src/Ice/EndpointI.cs2
-rw-r--r--cs/src/Ice/Instance.cs25
-rw-r--r--cs/src/Ice/Network.cs146
-rw-r--r--cs/src/Ice/PropertyNames.cs4
-rw-r--r--cs/src/Ice/ProtocolPluginFacade.cs13
-rw-r--r--cs/src/Ice/TcpAcceptor.cs2
-rw-r--r--cs/src/Ice/TcpConnector.cs24
-rw-r--r--cs/src/Ice/TcpEndpointI.cs13
-rw-r--r--cs/src/Ice/TcpTransceiver.cs134
-rw-r--r--cs/src/Ice/UdpConnector.cs15
-rw-r--r--cs/src/Ice/UdpEndpointI.cs5
-rw-r--r--cs/src/IceSSL/AcceptorI.cs2
-rw-r--r--cs/src/IceSSL/ConnectorI.cs11
-rw-r--r--cs/src/IceSSL/EndpointI.cs7
-rw-r--r--cs/src/IceSSL/Instance.cs5
-rw-r--r--cs/src/IceSSL/TransceiverI.cs114
-rw-r--r--cs/test/Ice/binding/AllTests.cs12
-rw-r--r--java/src/IceInternal/PropertyNames.java4
-rwxr-xr-xscripts/TestUtil.py26
25 files changed, 485 insertions, 144 deletions
diff --git a/config/PropertyNames.xml b/config/PropertyNames.xml
index c9bcd122b70..21636875741 100644
--- a/config/PropertyNames.xml
+++ b/config/PropertyNames.xml
@@ -352,6 +352,8 @@ generated from the section label.
<property name="ProgramName" />
<property name="RetryIntervals" />
<property name="ServerIdleTime" />
+ <property name="SOCKSProxyHost" />
+ <property name="SOCKSProxyPort" />
<property name="StdErr" />
<property name="StdOut" />
<property name="SyslogFacility" />
diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp
index 40c25e8807e..2bc22807c11 100644
--- a/cpp/src/Ice/PropertyNames.cpp
+++ b/cpp/src/Ice/PropertyNames.cpp
@@ -8,7 +8,7 @@
// **********************************************************************
//
-// Generated by makeprops.py from file ../config/PropertyNames.xml, Thu Feb 7 14:51:12 2013
+// Generated by makeprops.py from file ./config/PropertyNames.xml, Tue Mar 19 08:07:05 2013
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -110,6 +110,8 @@ const IceInternal::Property IcePropsData[] =
IceInternal::Property("Ice.ProgramName", false, 0),
IceInternal::Property("Ice.RetryIntervals", false, 0),
IceInternal::Property("Ice.ServerIdleTime", false, 0),
+ IceInternal::Property("Ice.SOCKSProxyHost", false, 0),
+ IceInternal::Property("Ice.SOCKSProxyPort", false, 0),
IceInternal::Property("Ice.StdErr", false, 0),
IceInternal::Property("Ice.StdOut", false, 0),
IceInternal::Property("Ice.SyslogFacility", false, 0),
diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h
index 7d256656f9c..d25341799bf 100644
--- a/cpp/src/Ice/PropertyNames.h
+++ b/cpp/src/Ice/PropertyNames.h
@@ -8,7 +8,7 @@
// **********************************************************************
//
-// Generated by makeprops.py from file ../config/PropertyNames.xml, Thu Feb 7 14:51:12 2013
+// Generated by makeprops.py from file ./config/PropertyNames.xml, Tue Mar 19 08:07:05 2013
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
diff --git a/cpp/src/slice2confluence/ConfluenceOutput.cpp b/cpp/src/slice2confluence/ConfluenceOutput.cpp
index 88861018728..ad62c1f0c25 100644
--- a/cpp/src/slice2confluence/ConfluenceOutput.cpp
+++ b/cpp/src/slice2confluence/ConfluenceOutput.cpp
@@ -786,7 +786,7 @@ Confluence::ConfluenceOutput::getMarkerLimits(const string& str)
end = str.find(TEMP_ESCAPER_END, start+TEMP_ESCAPER_START.size());
if(end != string::npos)
{
- pair<unsigned int, unsigned int> p = make_pair((unsigned int)start, (unsigned int)end+TEMP_ESCAPER_END.size());
+ pair<unsigned int, unsigned int> p = make_pair(static_cast<unsigned int>(start), static_cast<unsigned int>(end+TEMP_ESCAPER_END.size()));
pairs.push_back(p);
start = str.find(TEMP_ESCAPER_START, end+TEMP_ESCAPER_END.size());
}
diff --git a/cs/allTests.py b/cs/allTests.py
index c26c21f53de..9a89444dcb1 100755
--- a/cs/allTests.py
+++ b/cs/allTests.py
@@ -33,7 +33,7 @@ tests = [
("Ice/operations", ["core"]),
("Ice/exceptions", ["core"]),
("Ice/ami", ["core"]),
- ("Ice/info", ["core", "noipv6", "nocompress"]),
+ ("Ice/info", ["core", "noipv6", "nocompress", "nosocks"]),
("Ice/inheritance", ["core"]),
("Ice/facets", ["core"]),
("Ice/hold", ["core"]),
@@ -63,7 +63,7 @@ tests = [
("Ice/plugin", ["core", "nosilverlight"]),
("Ice/optional", ["core"]),
("Ice/admin", ["core", "nosilverlight"]),
- ("Ice/metrics", ["core", "nossl", "noipv6", "nocompress", "nosilverlight"]),
+ ("Ice/metrics", ["core", "nossl", "noipv6", "nocompress", "nosilverlight", "nosocks"]),
("Ice/enums", ["core"]),
("IceBox/admin", ["core", "noipv6", "nosilverlight", "nomx"]),
("IceBox/configuration", ["core", "noipv6", "nosilverlight", "nomx"]),
diff --git a/cs/src/Ice/EndpointHostResolver.cs b/cs/src/Ice/EndpointHostResolver.cs
index 15eff127b03..e65fc6fbf0c 100644
--- a/cs/src/Ice/EndpointHostResolver.cs
+++ b/cs/src/Ice/EndpointHostResolver.cs
@@ -28,7 +28,7 @@ namespace IceInternal
if(instance.initializationData().properties.getProperty("Ice.ThreadPriority").Length > 0)
{
ThreadPriority priority = IceInternal.Util.stringToThreadPriority(
- instance.initializationData().properties.getProperty("Ice.ThreadPriority"));
+ instance.initializationData().properties.getProperty("Ice.ThreadPriority"));
_thread.Start(priority);
}
else
@@ -44,10 +44,14 @@ namespace IceInternal
// Try to get the addresses without DNS lookup. If this doesn't
// work, we retry with DNS lookup (and observer).
//
- List<EndPoint> addrs = Network.getAddresses(host, port, _protocol, selType, _preferIPv6, false);
- if(addrs.Count > 0)
+ NetworkProxy networkProxy = _instance.networkProxy();
+ if(networkProxy == null)
{
- return endpoint.connectors(addrs);
+ List<EndPoint> addrs = Network.getAddresses(host, port, _protocol, selType, _preferIPv6, false);
+ if(addrs.Count > 0)
+ {
+ return endpoint.connectors(addrs, null);
+ }
}
Ice.Instrumentation.CommunicatorObserver obsv = _instance.initializationData().observer;
@@ -64,8 +68,14 @@ namespace IceInternal
List<Connector> connectors = null;
try
{
+ if(networkProxy != null)
+ {
+ networkProxy = networkProxy.resolveHost();
+ }
+
connectors = endpoint.connectors(Network.getAddresses(host, port, _protocol, selType, _preferIPv6,
- true));
+ true),
+ networkProxy);
}
catch(Ice.LocalException ex)
{
@@ -92,20 +102,24 @@ namespace IceInternal
// Try to get the addresses without DNS lookup. If this doesn't work, we queue a resolve
// entry and the thread will take care of getting the endpoint addresses.
//
- try
+ NetworkProxy networkProxy = _instance.networkProxy();
+ if(networkProxy == null)
{
- List<EndPoint> addrs = Network.getAddresses(host, port, _protocol, selType, _preferIPv6, false);
- if(addrs.Count > 0)
+ try
{
- callback.connectors(endpoint.connectors(addrs));
+ List<EndPoint> addrs = Network.getAddresses(host, port, _protocol, selType, _preferIPv6, false);
+ if(addrs.Count > 0)
+ {
+ callback.connectors(endpoint.connectors(addrs, null));
+ return;
+ }
+ }
+ catch(Ice.LocalException ex)
+ {
+ callback.exception(ex);
return;
}
}
- catch(Ice.LocalException ex)
- {
- callback.exception(ex);
- return;
- }
_m.Lock();
try
@@ -198,12 +212,19 @@ namespace IceInternal
Ice.Instrumentation.ThreadState.ThreadStateInUseForOther);
}
+ NetworkProxy networkProxy = _instance.networkProxy();
+ if(networkProxy != null)
+ {
+ networkProxy = networkProxy.resolveHost();
+ }
+
r.callback.connectors(r.endpoint.connectors(Network.getAddresses(r.host,
r.port,
_protocol,
r.selType,
_preferIPv6,
- true)));
+ true),
+ networkProxy));
if(threadObserver != null)
{
diff --git a/cs/src/Ice/EndpointI.cs b/cs/src/Ice/EndpointI.cs
index 4206f2093ba..98183010f71 100644
--- a/cs/src/Ice/EndpointI.cs
+++ b/cs/src/Ice/EndpointI.cs
@@ -167,7 +167,7 @@ namespace IceInternal
//
public abstract bool equivalent(EndpointI endpoint);
- public virtual List<Connector> connectors(List<EndPoint> addresses)
+ public virtual List<Connector> connectors(List<EndPoint> addresses, NetworkProxy proxy)
{
Debug.Assert(false);
return null;
diff --git a/cs/src/Ice/Instance.cs b/cs/src/Ice/Instance.cs
index ae6b5493ce3..1953f725440 100644
--- a/cs/src/Ice/Instance.cs
+++ b/cs/src/Ice/Instance.cs
@@ -220,6 +220,11 @@ namespace IceInternal
{
return _preferIPv6;
}
+
+ public NetworkProxy networkProxy()
+ {
+ return _networkProxy;
+ }
public ThreadPool clientThreadPool()
{
@@ -814,9 +819,18 @@ namespace IceInternal
_referenceFactory = new ReferenceFactory(this, communicator);
_proxyFactory = new ProxyFactory(this);
-
+
+ string proxyHost = _initData.properties.getProperty("Ice.SOCKSProxyHost");
+ int defaultIPv6 = 1; // IPv6 enabled by default.
+ if(proxyHost.Length > 0)
+ {
+ int proxyPort = _initData.properties.getPropertyAsIntWithDefault("Ice.SOCKSProxyPort", 1080);
+ _networkProxy = new SOCKS4NetworkProxy(proxyHost, proxyPort);
+ defaultIPv6 = 0; // IPv6 is not supported with SOCKS
+ }
+
bool ipv4 = _initData.properties.getPropertyAsIntWithDefault("Ice.IPv4", 1) > 0;
- bool ipv6 = _initData.properties.getPropertyAsIntWithDefault("Ice.IPv6", 1) > 0;
+ bool ipv6 = _initData.properties.getPropertyAsIntWithDefault("Ice.IPv6", defaultIPv6) > 0;
if(!ipv4 && !ipv6)
{
throw new Ice.InitializationException("Both IPV4 and IPv6 support cannot be disabled.");
@@ -834,6 +848,12 @@ namespace IceInternal
_protocolSupport = Network.EnableIPv6;
}
_preferIPv6 = _initData.properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0;
+
+ if(ipv6 && _networkProxy is SOCKS4NetworkProxy)
+ {
+ throw new Ice.InitializationException("IPv6 is not supported with SOCKS4 proxies.");
+ }
+
_endpointFactoryManager = new EndpointFactoryManager(this);
EndpointFactory tcpEndpointFactory = new TcpEndpointFactory(this);
_endpointFactoryManager.add(tcpEndpointFactory);
@@ -1234,6 +1254,7 @@ namespace IceInternal
private ObjectAdapterFactory _objectAdapterFactory;
private int _protocolSupport;
private bool _preferIPv6;
+ private NetworkProxy _networkProxy;
private ThreadPool _clientThreadPool;
private ThreadPool _serverThreadPool;
private AsyncIOThread _asyncIOThread;
diff --git a/cs/src/Ice/Network.cs b/cs/src/Ice/Network.cs
index 3841e89636c..de8a834ffb7 100644
--- a/cs/src/Ice/Network.cs
+++ b/cs/src/Ice/Network.cs
@@ -23,6 +23,133 @@ namespace IceInternal
using System.Threading;
using System.Globalization;
+ public interface NetworkProxy
+ {
+ //
+ // Write the connection request on the connection established
+ // with the network proxy server, this is called right after
+ // the connection establishment succeeds.
+ //
+ void beginWriteConnectRequest(EndPoint endpoint, Buffer buf);
+ void endWriteConnectRequest(Buffer buf);
+
+ //
+ // Once the connection request has been sent, this is called
+ // to prepare and read the response from the proxy server.
+ //
+ void beginReadConnectRequestResponse(Buffer buf);
+ void endReadConnectRequestResponse(Buffer buf);
+
+ //
+ // If the proxy host needs to be resolved, this should return
+ // a new NetworkProxy containing the IP address of the proxy.
+ // This is called from the endpoint host resolver thread, so
+ // it's safe if this this method blocks.
+ //
+ NetworkProxy resolveHost();
+
+ //
+ // Returns the IP address of the network proxy. This can't
+ // block. It's only called on a network proxy object returned
+ // by resolveHost().
+ //
+ EndPoint getAddress();
+ };
+
+ public sealed class SOCKS4NetworkProxy : NetworkProxy
+ {
+ public SOCKS4NetworkProxy(string host, int port)
+ {
+#if SILVERLIGHT
+ _address = new DnsEndPoint(host, port, AddressFamily.InterNetwork);
+#else
+ _host = host;
+ _port = port;
+#endif
+ }
+
+ private SOCKS4NetworkProxy(EndPoint address)
+ {
+ _address = address;
+ }
+
+ public void beginWriteConnectRequest(EndPoint endpoint, Buffer buf)
+ {
+ if(!(endpoint is IPEndPoint))
+ {
+ throw new Ice.FeatureNotSupportedException("SOCKS4 doesn't support domain names");
+ }
+ else if(endpoint.AddressFamily != AddressFamily.InterNetwork)
+ {
+ throw new Ice.FeatureNotSupportedException("SOCKS4 only supports IPv4 addresses");
+ }
+
+ //
+ // SOCKS connect request
+ //
+ IPEndPoint addr = (IPEndPoint)endpoint;
+ buf.resize(9, false);
+ ByteBuffer.ByteOrder order = buf.b.order();
+ buf.b.order(ByteBuffer.ByteOrder.BIG_ENDIAN); // Network byte order.
+ buf.b.position(0);
+ buf.b.put(0x04); // SOCKS version 4.
+ buf.b.put(0x01); // Command, establish a TCP/IP stream connection
+ buf.b.putShort((short)addr.Port); // Port
+ buf.b.put(addr.Address.GetAddressBytes()); // IPv4 address
+ buf.b.put(0x00); // User ID.
+ buf.b.position(0);
+ buf.b.limit(buf.size());
+ buf.b.order(order);
+ }
+
+ public void endWriteConnectRequest(Buffer buf)
+ {
+ buf.reset();
+ }
+
+ public void beginReadConnectRequestResponse(Buffer buf)
+ {
+ //
+ // Read the SOCKS4 response whose size is 8 bytes.
+ //
+ buf.resize(8, true);
+ buf.b.position(0);
+ }
+
+ public void endReadConnectRequestResponse(Buffer buf)
+ {
+ buf.b.position(0);
+ byte b1 = buf.b.get();
+ byte b2 = buf.b.get();
+ if(b1 != 0x00 || b2 != 0x5a)
+ {
+ throw new Ice.ConnectFailedException();
+ }
+ buf.reset();
+ }
+
+ public NetworkProxy resolveHost()
+ {
+ Debug.Assert(_host != null);
+ return new SOCKS4NetworkProxy(Network.getAddresses(_host,
+ _port,
+ Network.EnableIPv4,
+ Ice.EndpointSelectionType.Random,
+ false,
+ true)[0]);
+ }
+
+ public EndPoint getAddress()
+ {
+ Debug.Assert(_address != null); // Host must be resolved.
+ return _address;
+ }
+
+ private readonly string _host;
+ private readonly int _port;
+ private readonly EndPoint _address;
+ }
+
public sealed class Network
{
// ProtocolSupport
@@ -763,11 +890,11 @@ namespace IceInternal
#if SILVERLIGHT
if(protocol != EnableIPv4)
{
- return new DnsEndPoint(IPAddress.IPv6Any.ToString(), port);
+ return new DnsEndPoint(IPAddress.IPv6Any.ToString(), port, AddressFamily.InterNetwork);
}
else
{
- return new DnsEndPoint(IPAddress.Any.ToString(), port);
+ return new DnsEndPoint(IPAddress.Any.ToString(), port, AddressFamily.InterNetwork);
}
#else
if(protocol != EnableIPv4)
@@ -782,7 +909,7 @@ namespace IceInternal
}
#if SILVERLIGHT
- return new DnsEndPoint(host, port);
+ return new DnsEndPoint(host, port, AddressFamily.InterNetwork);
#else
return getAddresses(host, port, protocol, Ice.EndpointSelectionType.Ordered, preferIPv6, true)[0];
#endif
@@ -797,16 +924,16 @@ namespace IceInternal
{
if(protocol != EnableIPv4)
{
- addresses.Add(new DnsEndPoint(IPAddress.IPv6Loopback.ToString(), port));
+ addresses.Add(new DnsEndPoint(IPAddress.IPv6Loopback.ToString(), port, AddressFamily.InterNetwork));
}
else
{
- addresses.Add(new DnsEndPoint(IPAddress.Loopback.ToString(), port));
+ addresses.Add(new DnsEndPoint(IPAddress.Loopback.ToString(), port, AddressFamily.InterNetwork));
}
}
else
{
- addresses.Add(new DnsEndPoint(host, port));
+ addresses.Add(new DnsEndPoint(host, port, AddressFamily.InterNetwork));
}
#else
if(host.Length == 0)
@@ -1164,6 +1291,13 @@ namespace IceInternal
public static string
addrToString(EndPoint addr)
{
+#if !COMPACT
+ if(addr is DnsEndPoint)
+ {
+ DnsEndPoint e = (DnsEndPoint)addr;
+ return e.Host + ":" + e.Port;
+ }
+#endif
return addr.ToString();
}
diff --git a/cs/src/Ice/PropertyNames.cs b/cs/src/Ice/PropertyNames.cs
index 629f1a3299f..2fd3c36e9d1 100644
--- a/cs/src/Ice/PropertyNames.cs
+++ b/cs/src/Ice/PropertyNames.cs
@@ -8,7 +8,7 @@
// **********************************************************************
//
-// Generated by makeprops.py from file ../config/PropertyNames.xml, Thu Feb 7 14:51:12 2013
+// Generated by makeprops.py from file ./config/PropertyNames.xml, Tue Mar 19 08:07:05 2013
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -112,6 +112,8 @@ namespace IceInternal
new Property(@"^Ice\.ProgramName$", false, null),
new Property(@"^Ice\.RetryIntervals$", false, null),
new Property(@"^Ice\.ServerIdleTime$", false, null),
+ new Property(@"^Ice\.SOCKSProxyHost$", false, null),
+ new Property(@"^Ice\.SOCKSProxyPort$", false, null),
new Property(@"^Ice\.StdErr$", false, null),
new Property(@"^Ice\.StdOut$", false, null),
new Property(@"^Ice\.SyslogFacility$", false, null),
diff --git a/cs/src/Ice/ProtocolPluginFacade.cs b/cs/src/Ice/ProtocolPluginFacade.cs
index ad6693e15ab..87a45452f28 100644
--- a/cs/src/Ice/ProtocolPluginFacade.cs
+++ b/cs/src/Ice/ProtocolPluginFacade.cs
@@ -34,6 +34,11 @@ namespace IceInternal
bool getPreferIPv6();
//
+ // Get the proxy address.
+ //
+ NetworkProxy getNetworkProxy();
+
+ //
// Get the default encoding to be used in endpoints.
//
Ice.EncodingVersion getDefaultEncoding();
@@ -109,6 +114,14 @@ namespace IceInternal
}
//
+ // Get the proxy address.
+ //
+ public NetworkProxy getNetworkProxy()
+ {
+ return _instance.networkProxy();
+ }
+
+ //
// Get the default hostname to be used in endpoints.
//
public Ice.EncodingVersion getDefaultEncoding()
diff --git a/cs/src/Ice/TcpAcceptor.cs b/cs/src/Ice/TcpAcceptor.cs
index 031d36dd047..5d86fcbb2a2 100644
--- a/cs/src/Ice/TcpAcceptor.cs
+++ b/cs/src/Ice/TcpAcceptor.cs
@@ -111,7 +111,7 @@ namespace IceInternal
Socket acceptFd = _acceptFd;
_acceptFd = null;
_acceptError = null;
- return new TcpTransceiver(instance_, acceptFd, null, true);
+ return new TcpTransceiver(instance_, acceptFd, null, null, true);
}
public override string ToString()
diff --git a/cs/src/Ice/TcpConnector.cs b/cs/src/Ice/TcpConnector.cs
index 5ed55ae27e2..20d47fa1406 100644
--- a/cs/src/Ice/TcpConnector.cs
+++ b/cs/src/Ice/TcpConnector.cs
@@ -29,10 +29,8 @@ namespace IceInternal
try
{
-#if SILVERLIGHT
- Socket fd = Network.createSocket(false, AddressFamily.InterNetwork);
-#else
Socket fd = Network.createSocket(false, _addr.AddressFamily);
+#if !SILVERLIGHT
Network.setBlock(fd, false);
#endif
#if !COMPACT
@@ -42,7 +40,7 @@ namespace IceInternal
//
// Nonblocking connect is handled by the transceiver.
//
- return new TcpTransceiver(_instance, fd, _addr, false);
+ return new TcpTransceiver(_instance, fd, _addr, _proxy, false);
}
catch(Ice.LocalException ex)
{
@@ -63,16 +61,13 @@ namespace IceInternal
//
// Only for use by TcpEndpoint
//
- internal TcpConnector(Instance instance, EndPoint addr, int timeout, string connectionId)
+ internal TcpConnector(Instance instance, EndPoint addr, NetworkProxy proxy, int timeout, string connectionId)
{
_instance = instance;
_traceLevels = instance.traceLevels();
_logger = instance.initializationData().logger;
-#if SILVERLIGHT
- _addr = (DnsEndPoint)addr;
-#else
- _addr = (IPEndPoint)addr;
-#endif
+ _addr = addr;
+ _proxy = proxy;
_timeout = timeout;
_connectionId = connectionId;
@@ -110,7 +105,7 @@ namespace IceInternal
public override string ToString()
{
- return Network.addrToString(_addr);
+ return Network.addrToString(_proxy == null ? _addr : _proxy.getAddress());
}
public override int GetHashCode()
@@ -121,11 +116,8 @@ namespace IceInternal
private Instance _instance;
private TraceLevels _traceLevels;
private Ice.Logger _logger;
-#if SILVERLIGHT
- private DnsEndPoint _addr;
-#else
- private IPEndPoint _addr;
-#endif
+ private EndPoint _addr;
+ private NetworkProxy _proxy;
private int _timeout;
private string _connectionId;
private int _hashCode;
diff --git a/cs/src/Ice/TcpEndpointI.cs b/cs/src/Ice/TcpEndpointI.cs
index 879ec13843f..785bbe76b2e 100644
--- a/cs/src/Ice/TcpEndpointI.cs
+++ b/cs/src/Ice/TcpEndpointI.cs
@@ -394,15 +394,18 @@ namespace IceInternal
//
public override List<Connector> connectors(Ice.EndpointSelectionType selType)
{
- return connectors(Network.getAddresses(_host, _port, _instance.protocolSupport(), selType,
- _instance.preferIPv6(), true));
+#if SILVERLIGHT
+ return connectors(selType, _instance.networkProxy());
+#else
+ return _instance.endpointHostResolver().resolve(_host, _port, selType, this);
+#endif
}
public override void connectors_async(Ice.EndpointSelectionType selType, EndpointI_connectors callback)
{
#if SILVERLIGHT
- callback.connectors(connectors(selType));
+ callback.connectors(connectors(selType, _instance.networkProxy()));
#else
_instance.endpointHostResolver().resolve(_host, _port, selType, this, callback);
#endif
@@ -463,12 +466,12 @@ namespace IceInternal
return tcpEndpointI._host.Equals(_host) && tcpEndpointI._port == _port;
}
- public override List<Connector> connectors(List<EndPoint> addresses)
+ public override List<Connector> connectors(List<EndPoint> addresses, NetworkProxy networkProxy)
{
List<Connector> connectors = new List<Connector>();
foreach(EndPoint addr in addresses)
{
- connectors.Add(new TcpConnector(_instance, addr, _timeout, connectionId_));
+ connectors.Add(new TcpConnector(_instance, addr, networkProxy, _timeout, connectionId_));
}
return connectors;
}
diff --git a/cs/src/Ice/TcpTransceiver.cs b/cs/src/Ice/TcpTransceiver.cs
index 1d65eb75e65..ea2e30bca29 100644
--- a/cs/src/Ice/TcpTransceiver.cs
+++ b/cs/src/Ice/TcpTransceiver.cs
@@ -27,14 +27,14 @@ namespace IceInternal
{
public int initialize()
{
- if(_state == StateNeedConnect)
- {
- _state = StateConnectPending;
- return SocketOperation.Connect;
- }
- else if(_state <= StateConnectPending)
+ try
{
- try
+ if(_state == StateNeedConnect)
+ {
+ _state = StateConnectPending;
+ return SocketOperation.Connect;
+ }
+ else if(_state <= StateConnectPending)
{
#if ICE_SOCKET_ASYNC_API
if(_writeEventArgs.SocketError != SocketError.Success)
@@ -53,31 +53,57 @@ namespace IceInternal
Network.doFinishConnectAsync(_fd, _writeResult);
_writeResult = null;
#endif
- _state = StateConnected;
_desc = Network.fdToString(_fd);
+ if(_proxy != null)
+ {
+ _desc += "\ntarget address = " + Network.addrToString(_addr);
+ _state = StateProxyConnectRequest; // Send proxy connect request
+ return SocketOperation.Write;
+ }
+
+ _state = StateConnected;
}
- catch(Ice.LocalException ex)
+ else if(_state == StateProxyConnectRequest)
{
- if(_traceLevels.network >= 2)
+ _state = StateProxyConnectRequestPending; // Wait for proxy response
+ return SocketOperation.Read;
+ }
+ else if(_state == StateProxyConnectRequestPending)
+ {
+ _state = StateConnected;
+ }
+ }
+ catch(Ice.LocalException ex)
+ {
+ if(_traceLevels.network >= 2)
+ {
+ System.Text.StringBuilder s = new System.Text.StringBuilder();
+ s.Append("failed to establish tcp connection\n");
+ s.Append(Network.fdLocalAddressToString(_fd));
+ if(_proxy == null)
+ {
+ EndPoint addr = _addr == null ? Network.getRemoteAddress(_fd) : _addr;
+ s.Append("\nremote address = " + Network.addrToString(addr));
+ }
+ else
{
- System.Text.StringBuilder s = new System.Text.StringBuilder();
- s.Append("failed to establish tcp connection\n");
- s.Append(Network.fdLocalAddressToString(_fd));
Debug.Assert(_addr != null);
- s.Append("\nremote address = " + _addr.ToString() + "\n");
- s.Append(ex.ToString());
- _logger.trace(_traceLevels.networkCat, s.ToString());
+ s.Append("\nremote address = " + Network.addrToString(_proxy.getAddress()));
+ s.Append("\ntarget address = " + Network.addrToString(_addr));
}
- throw;
- }
-
- if(_traceLevels.network >= 1)
- {
- string s = "tcp connection established\n" + _desc;
- _logger.trace(_traceLevels.networkCat, s);
+ s.Append("\n");
+ s.Append(ex.ToString());
+ _logger.trace(_traceLevels.networkCat, s.ToString());
}
+ throw;
}
+
Debug.Assert(_state == StateConnected);
+ if(_traceLevels.network >= 1)
+ {
+ string s = "tcp connection established\n" + _desc;
+ _logger.trace(_traceLevels.networkCat, s);
+ }
return SocketOperation.None;
}
@@ -113,8 +139,8 @@ namespace IceInternal
#if COMPACT || SILVERLIGHT
//
// Silverlight and the Compact .NET Frameworks don't support the use of synchronous socket
- // operations on a non-blocking socket. Returning false here forces the
- // caller to schedule an asynchronous operation.
+ // operations on a non-blocking socket. Returning false here forces the caller to schedule
+ // an asynchronous operation.
//
return false;
#else
@@ -283,6 +309,10 @@ namespace IceInternal
#else
Debug.Assert(_fd != null && _readResult == null);
#endif
+ if(_state == StateProxyConnectRequestPending)
+ {
+ _proxy.beginReadConnectRequestResponse(buf);
+ }
int packetSize = buf.b.remaining();
if(_maxReceivePacketSize > 0 && packetSize > _maxReceivePacketSize)
@@ -370,6 +400,11 @@ namespace IceInternal
}
buf.b.position(buf.b.position() + ret);
+
+ if(_state == StateProxyConnectRequestPending)
+ {
+ _proxy.endReadConnectRequestResponse(buf);
+ }
}
catch(SocketException ex)
{
@@ -397,14 +432,30 @@ namespace IceInternal
if(_state < StateConnected)
{
completed = false;
- _writeCallback = callback;
+ if(_state == StateConnectPending)
+ {
+ _writeCallback = callback;
+ try
+ {
+ EndPoint addr = _proxy != null ? _proxy.getAddress() : _addr;
#if ICE_SOCKET_ASYNC_API
- _writeEventArgs.UserToken = state;
- return !_fd.ConnectAsync(_writeEventArgs);
+ _writeEventArgs.RemoteEndPoint = addr;
+ _writeEventArgs.UserToken = state;
+ return !_fd.ConnectAsync(_writeEventArgs);
#else
- _writeResult = Network.doConnectAsync(_fd, _addr, callback, state);
- return _writeResult.CompletedSynchronously;
+ _writeResult = Network.doConnectAsync(_fd, addr, callback, state);
+ return _writeResult.CompletedSynchronously;
#endif
+ }
+ catch(Exception ex)
+ {
+ throw new Ice.SocketException(ex);
+ }
+ }
+ else if(_state == StateProxyConnectRequest)
+ {
+ _proxy.beginWriteConnectRequest(_addr, buf);
+ }
}
//
@@ -469,11 +520,11 @@ namespace IceInternal
Debug.Assert(_fd != null && _writeResult != null);
#endif
- if(_state < StateConnected)
+ if(_state < StateConnected && _state != StateProxyConnectRequest)
{
return;
- }
-
+ }
+
try
{
#if ICE_SOCKET_ASYNC_API
@@ -511,6 +562,11 @@ namespace IceInternal
}
buf.b.position(buf.b.position() + ret);
+
+ if(_state == StateProxyConnectRequest)
+ {
+ _proxy.endWriteConnectRequest(buf);
+ }
}
catch(SocketException ex)
{
@@ -564,11 +620,12 @@ namespace IceInternal
//
// Only for use by TcpConnector, TcpAcceptor
//
- internal TcpTransceiver(Instance instance, Socket fd, EndPoint addr, bool connected)
+ internal TcpTransceiver(Instance instance, Socket fd, EndPoint addr, NetworkProxy proxy, bool connected)
{
_fd = fd;
_addr = addr;
-
+ _proxy = proxy;
+
_traceLevels = instance.traceLevels();
_logger = instance.initializationData().logger;
_stats = instance.initializationData().stats;
@@ -577,11 +634,9 @@ namespace IceInternal
#if ICE_SOCKET_ASYNC_API
_readEventArgs = new SocketAsyncEventArgs();
- _readEventArgs.RemoteEndPoint = _addr;
_readEventArgs.Completed += new EventHandler<SocketAsyncEventArgs>(ioCompleted);
_writeEventArgs = new SocketAsyncEventArgs();
- _writeEventArgs.RemoteEndPoint = _addr;
_writeEventArgs.Completed += new EventHandler<SocketAsyncEventArgs>(ioCompleted);
#if SILVERLIGHT
String policy = instance.initializationData().properties.getProperty("Ice.ClientAccessPolicyProtocol");
@@ -646,6 +701,7 @@ namespace IceInternal
private Socket _fd;
private EndPoint _addr;
+ private NetworkProxy _proxy;
private TraceLevels _traceLevels;
private Ice.Logger _logger;
private Ice.Stats _stats;
@@ -667,6 +723,8 @@ namespace IceInternal
private const int StateNeedConnect = 0;
private const int StateConnectPending = 1;
- private const int StateConnected = 2;
+ private const int StateProxyConnectRequest = 2;
+ private const int StateProxyConnectRequestPending = 3;
+ private const int StateConnected = 4;
}
}
diff --git a/cs/src/Ice/UdpConnector.cs b/cs/src/Ice/UdpConnector.cs
index 56f390eb88d..6e663e85256 100644
--- a/cs/src/Ice/UdpConnector.cs
+++ b/cs/src/Ice/UdpConnector.cs
@@ -29,15 +29,10 @@ namespace IceInternal
//
// Only for use by TcpEndpoint
//
- internal UdpConnector(Instance instance, EndPoint addr, string mcastInterface, int mcastTtl,
- string connectionId)
+ internal UdpConnector(Instance instance, EndPoint addr, string mcastInterface, int mcastTtl, string connectionId)
{
instance_ = instance;
-#if SILVERLIGHT
- _addr = (DnsEndPoint)addr;
-#else
- _addr = (IPEndPoint)addr;
-#endif
+ _addr = addr;
_mcastInterface = mcastInterface;
_mcastTtl = mcastTtl;
_connectionId = connectionId;
@@ -91,11 +86,7 @@ namespace IceInternal
}
private Instance instance_;
-#if SILVERLIGHT
- private DnsEndPoint _addr;
-#else
- private IPEndPoint _addr;
-#endif
+ private EndPoint _addr;
private string _mcastInterface;
private int _mcastTtl;
private string _connectionId;
diff --git a/cs/src/Ice/UdpEndpointI.cs b/cs/src/Ice/UdpEndpointI.cs
index 0fd961d435f..4a3d8288156 100644
--- a/cs/src/Ice/UdpEndpointI.cs
+++ b/cs/src/Ice/UdpEndpointI.cs
@@ -496,7 +496,8 @@ namespace IceInternal
public override List<Connector> connectors(Ice.EndpointSelectionType selType)
{
return connectors(Network.getAddresses(_host, _port, instance_.protocolSupport(), selType,
- instance_.preferIPv6(), true));
+ instance_.preferIPv6(), true),
+ instance_.networkProxy());
}
@@ -560,7 +561,7 @@ namespace IceInternal
return udpEndpointI._host.Equals(_host) && udpEndpointI._port == _port;
}
- public override List<Connector> connectors(List<EndPoint> addresses)
+ public override List<Connector> connectors(List<EndPoint> addresses, NetworkProxy networkProxy)
{
List<Connector> connectors = new List<Connector>();
foreach(EndPoint addr in addresses)
diff --git a/cs/src/IceSSL/AcceptorI.cs b/cs/src/IceSSL/AcceptorI.cs
index 59debbae468..622dd43a7fd 100644
--- a/cs/src/IceSSL/AcceptorI.cs
+++ b/cs/src/IceSSL/AcceptorI.cs
@@ -128,7 +128,7 @@ namespace IceSSL
Socket acceptFd = _acceptFd;
_acceptFd = null;
_acceptError = null;
- return new TransceiverI(_instance, acceptFd, "", true, true, _adapterName, null);
+ return new TransceiverI(_instance, acceptFd, "", true, true, _adapterName, null, null);
}
public override string ToString()
diff --git a/cs/src/IceSSL/ConnectorI.cs b/cs/src/IceSSL/ConnectorI.cs
index b9ae93ba031..87b54f95e72 100644
--- a/cs/src/IceSSL/ConnectorI.cs
+++ b/cs/src/IceSSL/ConnectorI.cs
@@ -55,7 +55,7 @@ namespace IceSSL
//
// Nonblocking connect is handled by the transceiver.
//
- return new TransceiverI(_instance, fd, _host, false, false, null, _addr);
+ return new TransceiverI(_instance, fd, _host, false, false, null, _addr, _proxy);
}
catch(Ice.LocalException ex)
{
@@ -76,14 +76,16 @@ namespace IceSSL
//
// Only for use by EndpointI.
//
- internal ConnectorI(Instance instance, string host, EndPoint addr, int timeout, string connectionId)
+ internal ConnectorI(Instance instance, string host, EndPoint addr, IceInternal.NetworkProxy proxy, int timeout,
+ string conId)
{
_instance = instance;
_host = host;
_logger = instance.communicator().getLogger();
_addr = (IPEndPoint)addr;
+ _proxy = proxy;
_timeout = timeout;
- _connectionId = connectionId;
+ _connectionId = conId;
_hashCode = 5381;
IceInternal.HashUtil.hashAdd(ref _hashCode, _addr);
@@ -119,7 +121,7 @@ namespace IceSSL
public override string ToString()
{
- return IceInternal.Network.addrToString(_addr);
+ return IceInternal.Network.addrToString(_proxy == null ? _addr : _proxy.getAddress());
}
public override int GetHashCode()
@@ -131,6 +133,7 @@ namespace IceSSL
private Ice.Logger _logger;
private string _host;
private IPEndPoint _addr;
+ private IceInternal.NetworkProxy _proxy;
private int _timeout;
private string _connectionId;
private int _hashCode;
diff --git a/cs/src/IceSSL/EndpointI.cs b/cs/src/IceSSL/EndpointI.cs
index 7c39c47b2a4..f698e65c858 100644
--- a/cs/src/IceSSL/EndpointI.cs
+++ b/cs/src/IceSSL/EndpointI.cs
@@ -394,8 +394,7 @@ namespace IceSSL
//
public override List<IceInternal.Connector> connectors(Ice.EndpointSelectionType selType)
{
- return connectors(IceInternal.Network.getAddresses(_host, _port, _instance.protocolSupport(), selType,
- _instance.preferIPv6(), true));
+ return _instance.endpointHostResolver().resolve(_host, _port, selType, this);
}
public override void connectors_async(Ice.EndpointSelectionType selType,
@@ -455,12 +454,12 @@ namespace IceSSL
return sslEndpointI._host.Equals(_host) && sslEndpointI._port == _port;
}
- public override List<IceInternal.Connector> connectors(List<EndPoint> addresses)
+ public override List<IceInternal.Connector> connectors(List<EndPoint> addresses, IceInternal.NetworkProxy proxy)
{
List<IceInternal.Connector> connectors = new List<IceInternal.Connector>();
foreach(EndPoint addr in addresses)
{
- connectors.Add(new ConnectorI(_instance, _host, addr, _timeout, connectionId_));
+ connectors.Add(new ConnectorI(_instance, _host, addr, proxy, _timeout, connectionId_));
}
return connectors;
}
diff --git a/cs/src/IceSSL/Instance.cs b/cs/src/IceSSL/Instance.cs
index cf58430df9a..c3f2cd55304 100644
--- a/cs/src/IceSSL/Instance.cs
+++ b/cs/src/IceSSL/Instance.cs
@@ -334,6 +334,11 @@ namespace IceSSL
return _facade.getPreferIPv6();
}
+ internal IceInternal.NetworkProxy networkProxy()
+ {
+ return _facade.getNetworkProxy();
+ }
+
internal Ice.EncodingVersion defaultEncoding()
{
return _facade.getDefaultEncoding();
diff --git a/cs/src/IceSSL/TransceiverI.cs b/cs/src/IceSSL/TransceiverI.cs
index 79303efb8e8..c13f57e6e98 100644
--- a/cs/src/IceSSL/TransceiverI.cs
+++ b/cs/src/IceSSL/TransceiverI.cs
@@ -38,11 +38,29 @@ namespace IceSSL
{
IceInternal.Network.doFinishConnectAsync(_fd, _writeResult);
_writeResult = null;
- _state = StateAuthenticatePending;
+
_desc = IceInternal.Network.fdToString(_fd);
+ if(_proxy != null)
+ {
+ _desc += "\ntarget address = " + IceInternal.Network.addrToString(_addr);
+ _state = StateProxyConnectRequest; // Send proxy connect request
+ return IceInternal.SocketOperation.Write;
+ }
+
+ _state = StateAuthenticatePending;
+ return IceInternal.SocketOperation.Connect;
+ }
+ else if(_state == StateProxyConnectRequest)
+ {
+ _state = StateProxyConnectRequestPending; // Wait for proxy response
+ return IceInternal.SocketOperation.Read;
+ }
+ else if(_state == StateProxyConnectRequestPending)
+ {
+ _state = StateAuthenticatePending;
return IceInternal.SocketOperation.Connect;
}
- if(_state == StateNeedAuthenticate)
+ else if(_state == StateNeedAuthenticate)
{
_state = StateAuthenticatePending;
return IceInternal.SocketOperation.Connect;
@@ -61,16 +79,17 @@ namespace IceSSL
{
System.Text.StringBuilder s = new System.Text.StringBuilder();
s.Append("failed to establish ssl connection\n");
- if(_incoming)
+ s.Append(IceInternal.Network.fdLocalAddressToString(_fd));
+ if(_proxy == null)
{
- s.Append(IceInternal.Network.addressesToString(IceInternal.Network.getLocalAddress(_fd),
- IceInternal.Network.getRemoteAddress(_fd)));
+ EndPoint addr = _addr == null ? IceInternal.Network.getRemoteAddress(_fd) : _addr;
+ s.Append("\nremote address = " + IceInternal.Network.addrToString(addr));
}
else
{
Debug.Assert(_addr != null);
- s.Append(IceInternal.Network.addressesToString(IceInternal.Network.getLocalAddress(_fd),
- _addr));
+ s.Append("\nremote address = " + IceInternal.Network.addrToString(_proxy.getAddress()));
+ s.Append("\ntarget address = " + IceInternal.Network.addrToString(_addr));
}
s.Append("\n");
s.Append(e.ToString());
@@ -130,6 +149,11 @@ namespace IceSSL
{
Debug.Assert(_fd != null);
+ if(_state == StateProxyConnectRequestPending)
+ {
+ _proxy.beginReadConnectRequestResponse(buf);
+ }
+
int packetSize = buf.b.remaining();
if(_maxReceivePacketSize > 0 && packetSize > _maxReceivePacketSize)
{
@@ -139,7 +163,16 @@ namespace IceSSL
try
{
_readCallback = callback;
- _readResult = _stream.BeginRead(buf.b.rawBytes(), buf.b.position(), packetSize, readCompleted, state);
+ if(_stream != null)
+ {
+ _readResult = _stream.BeginRead(buf.b.rawBytes(), buf.b.position(), packetSize, readCompleted,
+ state);
+ }
+ else
+ {
+ _readResult = _fd.BeginReceive(buf.b.rawBytes(), buf.b.position(), packetSize, SocketFlags.None,
+ readCompleted, state);
+ }
return _readResult.CompletedSynchronously;
}
catch(IOException ex)
@@ -180,7 +213,7 @@ namespace IceSSL
try
{
- int ret = _stream.EndRead(_readResult);
+ int ret = _stream != null ? _stream.EndRead(_readResult) : _fd.EndReceive(_readResult);
_readResult = null;
if(ret == 0)
{
@@ -208,6 +241,11 @@ namespace IceSSL
}
buf.b.position(buf.b.position() + ret);
+
+ if(_state == StateProxyConnectRequestPending)
+ {
+ _proxy.endReadConnectRequestResponse(buf);
+ }
}
catch(IOException ex)
{
@@ -242,15 +280,26 @@ namespace IceSSL
if(_state < StateConnected)
{
+ completed = false;
if(_state == StateConnectPending)
{
- _writeResult = IceInternal.Network.doConnectAsync(_fd, _addr, callback, state);
- completed = false;
- return _writeResult.CompletedSynchronously;
+ try
+ {
+ EndPoint addr = _proxy != null ? _proxy.getAddress() : _addr;
+ _writeResult = IceInternal.Network.doConnectAsync(_fd, addr, callback, state);
+ return _writeResult.CompletedSynchronously;
+ }
+ catch(Exception ex)
+ {
+ throw new Ice.SocketException(ex);
+ }
+ }
+ else if(_state == StateProxyConnectRequest)
+ {
+ _proxy.beginWriteConnectRequest(_addr, buf);
}
else if(_state == StateAuthenticatePending)
{
- completed = false;
return beginAuthenticate(callback, state);
}
}
@@ -268,7 +317,16 @@ namespace IceSSL
try
{
_writeCallback = callback;
- _writeResult = _stream.BeginWrite(buf.b.rawBytes(), buf.b.position(), packetSize, writeCompleted, state);
+ if(_stream != null)
+ {
+ _writeResult = _stream.BeginWrite(buf.b.rawBytes(), buf.b.position(), packetSize, writeCompleted,
+ state);
+ }
+ else
+ {
+ _writeResult = _fd.BeginSend(buf.b.rawBytes(), buf.b.position(), packetSize, SocketFlags.None,
+ writeCompleted, state);
+ }
completed = packetSize == buf.b.remaining();
return _writeResult.CompletedSynchronously;
}
@@ -310,7 +368,7 @@ namespace IceSSL
return;
}
- if(_state < StateConnected)
+ if(_state < StateConnected && _state != StateProxyConnectRequest)
{
return;
}
@@ -319,7 +377,14 @@ namespace IceSSL
try
{
- _stream.EndWrite(_writeResult);
+ if(_stream != null)
+ {
+ _stream.EndWrite(_writeResult);
+ }
+ else
+ {
+ _fd.EndSend(_writeResult);
+ }
_writeResult = null;
int packetSize = buf.b.remaining();
@@ -342,6 +407,11 @@ namespace IceSSL
}
buf.b.position(buf.b.position() + packetSize);
+
+ if(_state == StateProxyConnectRequest)
+ {
+ _proxy.endWriteConnectRequest(buf);
+ }
}
catch(IOException ex)
{
@@ -396,7 +466,7 @@ namespace IceSSL
// Only for use by ConnectorI, AcceptorI.
//
internal TransceiverI(Instance instance, Socket fd, string host, bool connected,
- bool incoming, string adapterName, IPEndPoint addr)
+ bool incoming, string adapterName, IPEndPoint addr, IceInternal.NetworkProxy proxy)
{
_instance = instance;
_fd = fd;
@@ -404,6 +474,7 @@ namespace IceSSL
_incoming = incoming;
_adapterName = adapterName;
_addr = addr;
+ _proxy = proxy;
_stream = null;
_logger = instance.communicator().getLogger();
_stats = instance.communicator().getStats();
@@ -780,6 +851,7 @@ namespace IceSSL
private bool _incoming;
private string _adapterName;
private IPEndPoint _addr;
+ private IceInternal.NetworkProxy _proxy;
private SslStream _stream;
private Ice.Logger _logger;
private Ice.Stats _stats;
@@ -796,8 +868,10 @@ namespace IceSSL
private const int StateNeedConnect = 0;
private const int StateConnectPending = 1;
- private const int StateNeedAuthenticate = 2;
- private const int StateAuthenticatePending = 3;
- private const int StateConnected = 4;
+ private const int StateProxyConnectRequest = 2;
+ private const int StateProxyConnectRequestPending = 3;
+ private const int StateNeedAuthenticate = 4;
+ private const int StateAuthenticatePending = 5;
+ private const int StateConnected = 6;
}
}
diff --git a/cs/test/Ice/binding/AllTests.cs b/cs/test/Ice/binding/AllTests.cs
index 9d7ad782642..94dcbefbb71 100644
--- a/cs/test/Ice/binding/AllTests.cs
+++ b/cs/test/Ice/binding/AllTests.cs
@@ -160,7 +160,7 @@ public class AllTests : TestCommon.TestApp
test3.ice_ping();
test(false);
}
- catch(Ice.ConnectionRefusedException)
+ catch(Ice.ConnectFailedException)
{
}
}
@@ -520,7 +520,7 @@ public class AllTests : TestCommon.TestApp
{
obj.getAdapterName();
}
- catch(Ice.ConnectionRefusedException)
+ catch(Ice.ConnectFailedException)
{
}
@@ -569,7 +569,7 @@ public class AllTests : TestCommon.TestApp
test(test3.ice_getConnection() == test1.ice_getConnection());
test(false);
}
- catch(Ice.ConnectionRefusedException)
+ catch(Ice.ConnectFailedException)
{
}
}
@@ -685,7 +685,7 @@ public class AllTests : TestCommon.TestApp
{
obj.getAdapterName();
}
- catch(Ice.ConnectionRefusedException)
+ catch(Ice.ConnectFailedException)
{
}
@@ -745,7 +745,7 @@ public class AllTests : TestCommon.TestApp
{
obj.getAdapterName();
}
- catch(Ice.ConnectionRefusedException)
+ catch(Ice.ConnectFailedException)
{
}
@@ -841,7 +841,7 @@ public class AllTests : TestCommon.TestApp
testSecure.ice_ping();
test(false);
}
- catch(Ice.ConnectionRefusedException)
+ catch(Ice.ConnectFailedException)
{
}
diff --git a/java/src/IceInternal/PropertyNames.java b/java/src/IceInternal/PropertyNames.java
index 550f900b28b..5d6d767cfd0 100644
--- a/java/src/IceInternal/PropertyNames.java
+++ b/java/src/IceInternal/PropertyNames.java
@@ -8,7 +8,7 @@
// **********************************************************************
//
-// Generated by makeprops.py from file ../config/PropertyNames.xml, Thu Feb 7 14:51:12 2013
+// Generated by makeprops.py from file ./config/PropertyNames.xml, Tue Mar 19 08:07:05 2013
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -112,6 +112,8 @@ public final class PropertyNames
new Property("Ice\\.ProgramName", false, null),
new Property("Ice\\.RetryIntervals", false, null),
new Property("Ice\\.ServerIdleTime", false, null),
+ new Property("Ice\\.SOCKSProxyHost", false, null),
+ new Property("Ice\\.SOCKSProxyPort", false, null),
new Property("Ice\\.StdErr", false, null),
new Property("Ice\\.StdOut", false, null),
new Property("Ice\\.SyslogFacility", false, null),
diff --git a/scripts/TestUtil.py b/scripts/TestUtil.py
index 0793c16ce61..6bbe35a032f 100755
--- a/scripts/TestUtil.py
+++ b/scripts/TestUtil.py
@@ -18,6 +18,7 @@ debug = False # Set to True to enable test suite debugging.
mono = False # Set to True when not on Windows
keepGoing = False # Set to True to have the tests continue on failure.
ipv6 = False # Default to use IPv4 only
+socksProxy = False # Use SOCKS proxy running on localhost
iceHome = None # Binary distribution to use (None to use binaries from source distribution)
x64 = False # Binary distribution is 64-bit
cpp11 = False # Binary distribution is c++ 11
@@ -53,7 +54,7 @@ def isWin32():
return sys.platform == "win32" or isCygwin()
def isVista():
- return isWin32() and sys.getwindowsversion()[0] == 6
+ return isWin32() and sys.getwindowsversion()[0] == 6 and sys.getwindowsversion()[1] == 0
def isWin9x():
if isWin32():
@@ -269,6 +270,7 @@ def run(tests, root = False):
--serialize Run with connection serialization.
--continue Keep running when a test fails
--ipv6 Use IPv6 addresses.
+ --socks Use SOCKS proxy running on localhost.
--no-ipv6 Don't use IPv6 addresses.
--ice-home=<path> Use the binary distribution from the given path.
--x64 Binary distribution is 64-bit.
@@ -296,7 +298,8 @@ def run(tests, root = False):
opts, args = getopt.getopt(sys.argv[1:], "lr:R:",
["start=", "start-after=", "filter=", "rfilter=", "all", "all-cross", "loop",
"debug", "protocol=", "compress", "valgrind", "host=", "serialize", "continue",
- "ipv6", "no-ipv6", "ice-home=", "cross=", "client-home=", "x64", "script", "env",
+ "ipv6", "no-ipv6", "socks", "ice-home=", "cross=", "client-home=", "x64",
+ "script", "env",
"sql-type=", "sql-db=", "sql-host=", "sql-port=", "sql-user=", "sql-passwd=",
"service-dir=", "appverifier", "compact", "silverlight", "winrt", "server", "mx",
"c++11"])
@@ -363,7 +366,8 @@ def run(tests, root = False):
sys.exit(1)
if o in ( "--cross", "--protocol", "--host", "--debug", "--compress", "--valgrind", "--serialize", "--ipv6", \
- "--ice-home", "--x64", "--env", "--sql-type", "--sql-db", "--sql-host", "--sql-port", "--sql-user", \
+ "--socks", "--ice-home", "--x64", "--env", \
+ "--sql-type", "--sql-db", "--sql-host", "--sql-port", "--sql-user", \
"--sql-passwd", "--service-dir", "--appverifier", "--compact", "--silverlight", "--winrt", \
"--server", "--mx", "--client-home", "--c++11"):
arg += " " + o
@@ -741,6 +745,7 @@ class DriverConfig:
type = None
overrides = None
ipv6 = False
+ socksProxy = False
x64 = False
cpp11 = False
sqlType = None
@@ -761,6 +766,7 @@ class DriverConfig:
global valgrind
global appverifier
global ipv6
+ global socksProxy
global x64
global cpp11
global sqlType
@@ -783,6 +789,7 @@ class DriverConfig:
self.appverifier = appverifier
self.type = type
self.ipv6 = ipv6
+ self.socksProxy = socksProxy
self.x64 = x64
self.cpp11 = cpp11
self.sqlType = sqlType
@@ -873,6 +880,9 @@ def getCommandLineProperties(exe, config):
components.append("--IceMX.Metrics.Parent.GroupBy=parent")
components.append("--IceMX.Metrics.All.GroupBy=none")
+ if config.socksProxy:
+ components.append("--Ice.SOCKSProxyHost=127.0.0.1")
+
if config.ipv6:
components.append("--Ice.IPv4=1 --Ice.IPv6=1 --Ice.PreferIPv6Address=1")
if config.host == None:
@@ -1611,6 +1621,7 @@ def processCmdLine():
--host=host Set --Ice.Default.Host=<host>.
--serialize Run with connection serialization.
--ipv6 Use IPv6 addresses.
+ --socks Use SOCKS proxy running on localhost.
--ice-home=<path> Use the binary distribution from the given path.
--x64 Binary distribution is 64-bit.
--c++11 Binary distribution is c++11.
@@ -1635,7 +1646,7 @@ def processCmdLine():
try:
opts, args = getopt.getopt(
sys.argv[1:], "", ["debug", "trace=", "protocol=", "compress", "valgrind", "host=", "serialize", "ipv6", \
- "ice-home=", "x64", "cross=", "client-home=", "env", "sql-type=", "sql-db=", \
+ "socks", "ice-home=", "x64", "cross=", "client-home=", "env", "sql-type=", "sql-db=", \
"sql-host=", "sql-port=", "sql-user=", "sql-passwd=", "service-dir=", "appverifier", \
"compact", "silverlight", "winrt", "server", "mx", "c++11"])
except getopt.GetoptError:
@@ -1689,6 +1700,9 @@ def processCmdLine():
elif o == "--ipv6":
global ipv6
ipv6 = True
+ elif o == "--socks":
+ global socksProxy
+ socksProxy = True
if o == "--trace":
global tracefile
if a == "stdout":
@@ -1818,6 +1832,10 @@ def runTests(start, expanded, num = 0, script = False):
print("%s*** test not supported with compression%s" % (prefix, suffix))
continue
+ if args.find("socks") != -1 and "nosocks" in config:
+ print("%s*** test not supported with SOCKS%s" % (prefix, suffix))
+ continue
+
if args.find("compact") != -1 and "nocompact" in config:
print("%s*** test not supported with Compact Framework%s" % (prefix, suffix))
continue