本文整理汇总了C#中Ice.proxyToString方法的典型用法代码示例。如果您正苦于以下问题:C# Ice.proxyToString方法的具体用法?C# Ice.proxyToString怎么用?C# Ice.proxyToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ice
的用法示例。
在下文中一共展示了Ice.proxyToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: allTests
//.........这里部分代码省略.........
{
// Missing -v
communicator.stringToProxy("id:opaque -t 1");
test(false);
}
catch(Ice.EndpointParseException)
{
}
try
{
// Missing arg for -t
communicator.stringToProxy("id:opaque -t -v abc");
test(false);
}
catch(Ice.EndpointParseException)
{
}
try
{
// Missing arg for -v
communicator.stringToProxy("id:opaque -t 1 -v");
test(false);
}
catch(Ice.EndpointParseException)
{
}
try
{
// Not a number for -t
communicator.stringToProxy("id:opaque -t x -v abc");
test(false);
}
catch(Ice.EndpointParseException)
{
}
try
{
// < 0 for -t
communicator.stringToProxy("id:opaque -t -1 -v abc");
test(false);
}
catch(Ice.EndpointParseException)
{
}
try
{
// Invalid char for -v
communicator.stringToProxy("id:opaque -t 99 -v x?c");
test(false);
}
catch(Ice.EndpointParseException)
{
}
// Legal TCP endpoint expressed as opaque endpoint
Ice.ObjectPrx p1 = communicator.stringToProxy("test -e 1.1:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA==");
string pstr = communicator.proxyToString(p1);
test(pstr.Equals("test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000"));
// Opaque endpoint encoded with 1.1 encoding.
Ice.ObjectPrx p2 = communicator.stringToProxy("test -e 1.1:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==");
test(communicator.proxyToString(p2).Equals("test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000"));
if(communicator.getProperties().getPropertyAsInt("Ice.IPv6") == 0)
{
// Working?
bool ssl = communicator.getProperties().getProperty("Ice.Default.Protocol").Equals("ssl");
bool tcp = communicator.getProperties().getProperty("Ice.Default.Protocol").Equals("tcp");
if(tcp)
{
p1.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping();
}
// Two legal TCP endpoints expressed as opaque endpoints
p1 = communicator.stringToProxy("test -e 1.0:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA==");
pstr = communicator.proxyToString(p1);
test(pstr.Equals("test -t -e 1.0:tcp -h 127.0.0.1 -p 12010 -t 10000:tcp -h 127.0.0.2 -p 12011 -t 10000"));
// Test that an SSL endpoint and a nonsense endpoint get written back out as an opaque endpoint.
p1 = communicator.stringToProxy("test -e 1.0:opaque -e 1.0 -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -e 1.0 -t 99 -v abch");
pstr = communicator.proxyToString(p1);
if(ssl)
{
test(pstr.Equals("test -t -e 1.0:ssl -h 127.0.0.1 -p 10001 -t infinite:opaque -t 99 -e 1.0 -v abch"));
}
else if(tcp)
{
test(pstr.Equals(
"test -t -e 1.0:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch"));
}
}
WriteLine("ok");
return cl;
}
示例2: allTests
//.........这里部分代码省略.........
}
try
{
// Not a number for -t
communicator.stringToProxy("id:opaque -t x -v abc");
test(false);
}
catch(Ice.EndpointParseException)
{
}
try
{
// < 0 for -t
communicator.stringToProxy("id:opaque -t -1 -v abc");
test(false);
}
catch(Ice.EndpointParseException)
{
}
try
{
// Invalid char for -v
communicator.stringToProxy("id:opaque -t 99 -v x?c");
test(false);
}
catch(Ice.EndpointParseException)
{
}
// Legal TCP endpoint expressed as opaque endpoint
Ice.ObjectPrx p1 = communicator.stringToProxy("test:opaque -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==");
String pstr = communicator.proxyToString(p1);
test(pstr.Equals("test -t:tcp -h 127.0.0.1 -p 12010 -t 10000"));
if(communicator.getProperties().getPropertyAsInt("Ice.IPv6") == 0)
{
// Working?
bool ssl = communicator.getProperties().getProperty("Ice.Default.Protocol").Equals("ssl");
if(!ssl)
{
p1.ice_ping();
}
// Two legal TCP endpoints expressed as opaque endpoints
p1 = communicator.stringToProxy("test:opaque -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA==");
pstr = communicator.proxyToString(p1);
test(pstr.Equals("test -t:tcp -h 127.0.0.1 -p 12010 -t 10000:tcp -h 127.0.0.2 -p 12011 -t 10000"));
// Test that an SSL endpoint and a nonsense endpoint get written back out as an opaque endpoint.
p1 = communicator.stringToProxy("test:opaque -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -v abch");
pstr = communicator.proxyToString(p1);
if(!ssl)
{
test(pstr.Equals("test -t:opaque -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -v abch"));
}
else
{
test(pstr.Equals("test -t:ssl -h 127.0.0.1 -p 10001:opaque -t 99 -v abch"));
}
// Try to invoke on the SSL endpoint to verify that we get a
// NoEndpointException (or ConnectionRefusedException when
// running with SSL).
try
{
p1.ice_ping();
test(false);
}
catch(Ice.NoEndpointException)
{
test(!ssl);
}
catch(Ice.ConnectionRefusedException)
{
test(ssl);
}
// Test that the proxy with an SSL endpoint and a nonsense
// endpoint (which the server doesn't understand either)
// can be sent over the wire and returned by the server
// without losing the opaque endpoints.
Ice.ObjectPrx p2 = derived.echo(p1);
pstr = communicator.proxyToString(p2);
if(!ssl)
{
test(pstr.Equals("test -t:opaque -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -v abch"));
}
else
{
test(pstr.Equals("test -t:ssl -h 127.0.0.1 -p 10001:opaque -t 99 -v abch"));
}
}
Console.Out.WriteLine("ok");
return cl;
}