本文整理汇总了C++中ice::CommunicatorPtr::proxyToString方法的典型用法代码示例。如果您正苦于以下问题:C++ CommunicatorPtr::proxyToString方法的具体用法?C++ CommunicatorPtr::proxyToString怎么用?C++ CommunicatorPtr::proxyToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ice::CommunicatorPtr
的用法示例。
在下文中一共展示了CommunicatorPtr::proxyToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
bool
isRegistryReachable( const Context& context )
{
Ice::CommunicatorPtr ic = context.communicator();
assert( ic );
Ice::LocatorPrx locatorPrx = ic->getDefaultLocator();
// debug
context.tracer().debug( "pinging "+ic->proxyToString( locatorPrx ),5 );
try
{
// ping the registry
locatorPrx->ice_ping();
return true;
}
catch( const std::exception &e )
{
std::stringstream ss;
ss << "orcaice::isRegistryReachable(): caught exception: " << e.what();
context.tracer().debug( ss.str() ,5 );
}
return false;
}
示例2: if
//.........这里部分代码省略.........
try
{
// Not a number for -t
Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t x -v abc");
test(false);
}
catch(const Ice::EndpointParseException&)
{
}
try
{
// < 0 for -t
Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t -1 -v abc");
test(false);
}
catch(const Ice::EndpointParseException&)
{
}
try
{
// Invalid char for -v
Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t 99 -v x?c");
test(false);
}
catch(const Ice::EndpointParseException&)
{
}
// Legal TCP endpoint expressed as opaque endpoint
Ice::ObjectPrx p1 = communicator->stringToProxy("test -e 1.1:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==");
string pstr = communicator->proxyToString(p1);
test(pstr == "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) == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000");
if(communicator->getProperties()->getPropertyAsInt("Ice.IPv6") == 0)
{
// Working?
#ifndef ICE_OS_WINRT
const bool ssl = communicator->getProperties()->getProperty("Ice.Default.Protocol") == "ssl";
#else
const bool ssl = true;
#endif
const bool tcp = communicator->getProperties()->getProperty("Ice.Default.Protocol") == "tcp";
if(tcp)
{
p1->ice_encodingVersion(Ice::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 == "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);
示例3: tprintf
//.........这里部分代码省略.........
try
{
// Missing arg for -t
Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t -v abc");
test(false);
}
catch(const Ice::EndpointParseException&)
{
}
try
{
// Missing arg for -v
Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t 1 -v");
test(false);
}
catch(const Ice::EndpointParseException&)
{
}
try
{
// Not a number for -t
Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t x -v abc");
test(false);
}
catch(const Ice::EndpointParseException&)
{
}
try
{
// < 0 for -t
Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t -1 -v abc");
test(false);
}
catch(const Ice::EndpointParseException&)
{
}
try
{
// Invalid char for -v
Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t 99 -v x?c");
test(false);
}
catch(const 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 == "test -t:tcp -h 127.0.0.1 -p 12010 -t 10000");
// Working?
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 == "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);
test(pstr == "test -t:opaque -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -v abch");
//
// Try to invoke on the SSL endpoint to verify that we get a
// NoEndpointException.
//
try
{
p1->ice_ping();
test(false);
}
catch(const Ice::NoEndpointException&)
{
}
//
// 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);
test(pstr == "test -t:opaque -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -v abch");
tprintf("ok\n");
#endif
return cl;
}