本文整理汇总了C#中Configuration.readReady方法的典型用法代码示例。如果您正苦于以下问题:C# Configuration.readReady方法的具体用法?C# Configuration.readReady怎么用?C# Configuration.readReady使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configuration
的用法示例。
在下文中一共展示了Configuration.readReady方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: validationTests
private static void validationTests(Configuration configuration, Test.BackgroundPrx background,
Test.BackgroundControllerPrx ctl)
{
try
{
background.op();
}
catch(Ice.LocalException)
{
test(false);
}
closeConnection(background);
try
{
// Get the read() of connection validation to throw right away.
configuration.readException(new Ice.SocketException());
background.op();
test(false);
}
catch(Ice.SocketException)
{
configuration.readException(null);
}
for(int i = 0; i < 2; ++i)
{
configuration.readException(new Ice.SocketException());
BackgroundPrx prx = i == 0 ? background : (BackgroundPrx)background.ice_oneway();
Ice.AsyncResult r = prx.begin_op();
test(!r.sentSynchronously());
try
{
prx.end_op(r);
test(false);
}
catch(Ice.SocketException)
{
}
test(r.IsCompleted);
configuration.readException(null);
}
if(!background.ice_getCommunicator().getProperties().getProperty("Ice.Default.Protocol").Equals("test-ssl") &&
!background.ice_getCommunicator().getProperties().getProperty("Ice.Default.Protocol").Equals("test-wss"))
{
try
{
// Get the read() of the connection validation to return "would block"
configuration.readReady(false);
background.op();
configuration.readReady(true);
}
catch(Ice.LocalException ex)
{
Console.Error.WriteLine(ex);
test(false);
}
closeConnection(background);
try
{
// Get the read() of the connection validation to return "would block" and then throw.
configuration.readReady(false);
configuration.readException(new Ice.SocketException());
background.op();
test(false);
}
catch(Ice.SocketException)
{
configuration.readException(null);
configuration.readReady(true);
}
for(int i = 0; i < 2; ++i)
{
configuration.readReady(false);
configuration.readException(new Ice.SocketException());
Ice.AsyncResult r = background.begin_op();
test(!r.sentSynchronously());
try
{
background.end_op(r);
test(false);
}
catch(Ice.SocketException)
{
}
test(r.IsCompleted);
configuration.readException(null);
configuration.readReady(true);
}
}
{
ctl.holdAdapter(); // Hold to block in connection validation
Ice.AsyncResult r = background.begin_op();
Ice.AsyncResult r2 = background.begin_op();
test(!r.sentSynchronously() && !r2.sentSynchronously());
test(!r.IsCompleted && !r2.IsCompleted);
//.........这里部分代码省略.........
示例2: readWriteTests
private static void readWriteTests(Configuration configuration, Test.BackgroundPrx background,
Test.BackgroundControllerPrx ctl)
{
try
{
background.op();
}
catch(Ice.LocalException ex)
{
Console.Error.WriteLine(ex);
test(false);
}
for(int i = 0; i < 2; ++i)
{
BackgroundPrx prx = i == 0 ? background : (BackgroundPrx)background.ice_oneway();
try
{
prx.ice_ping();
configuration.writeException(new Ice.SocketException());
prx.op();
test(false);
}
catch(Ice.SocketException)
{
configuration.writeException(null);
}
background.ice_ping();
configuration.writeException(new Ice.SocketException());
Ice.AsyncResult r = prx.begin_op();
test(!r.sentSynchronously());
try
{
prx.end_op(r);
test(false);
}
catch(Ice.SocketException)
{
}
test(r.IsCompleted);
configuration.writeException(null);
}
try
{
background.ice_ping();
configuration.readException(new Ice.SocketException());
background.op();
test(false);
}
catch(Ice.SocketException)
{
configuration.readException(null);
}
{
background.ice_ping();
configuration.readReady(false); // Required in C# to make sure beginRead() doesn't throw too soon.
configuration.readException(new Ice.SocketException());
Ice.AsyncResult r = background.begin_op();
try
{
background.end_op(r);
test(false);
}
catch(Ice.SocketException)
{
}
test(r.IsCompleted);
configuration.readException(null);
configuration.readReady(true);
}
try
{
background.ice_ping();
configuration.writeReady(false);
background.op();
configuration.writeReady(true);
}
catch(Ice.LocalException)
{
test(false);
}
try
{
background.ice_ping();
configuration.readReady(false);
background.op();
configuration.readReady(true);
}
catch(Ice.LocalException)
{
test(false);
}
try
//.........这里部分代码省略.........