本文整理汇总了C#中Connector.IsConnected方法的典型用法代码示例。如果您正苦于以下问题:C# Connector.IsConnected方法的具体用法?C# Connector.IsConnected怎么用?C# Connector.IsConnected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connector
的用法示例。
在下文中一共展示了Connector.IsConnected方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: testConstructor
public void testConstructor()
{
TestUtil.INIT_TESTCASE("testConstructor");
Connector c1 = new Connector();
Assertion.Assert("!c1.IsConnected()", !c1.IsConnected());
}
示例2: testConnect
public void testConnect()
{
TestUtil.INIT_TESTCASE("testConnect");
Connector c1 = new Connector();
Parameters p1 = new Parameters();
bool b;
b = c1.Open(p1);
Assertion.Assert("!b", !b);
Assertion.Assert("!c1.IsConnected()", !c1.IsConnected());
p1.ServerUrl = TestUtil.getServer();
b = c1.Open(p1);
Assertion.Assert("b", b);
Assertion.Assert("c1.IsConnected()", c1.IsConnected());
}
示例3: testPub
public void testPub()
{
TestUtil.INIT_TESTCASE("testPub");
TestUtil.resetCounters();
Connector c1 = new Connector();
Parameters p1 = new Parameters();
TestUtil.PubRequestStatusHandler prsh = new TestUtil.PubRequestStatusHandler();
bool b;
p1.ServerUrl = TestUtil.getServer();
b = c1.Open(p1);
Assertion.Assert("b", b);
Assertion.Assert("c1.IsConnected()", c1.IsConnected());
Message m1 = new Message();
m1.Set("do_method", "notify");
m1.Set("kn_to", "/what/knchat/messages");
m1.Set("nickname", "abc");
m1.Set("kn_response_format", "simple");
for(int i = 1; i <= 10; i++)
{
m1.Set("kn_payload", "Hello-" + i);
b = c1.Publish(m1, prsh);
}
TestUtil.dumpCounters();
//pubReqSH OnSuccess : 10 pub connections -----------------+
//pubReqSH OnError : ---------------------------------+ |
//pubConnSH OnConnStatus : No conn status handler -------+ | |
//subReqSH OnSuccess : No sub --------------------+ | | |
//subReqSH OnError : No sub -----------------+ | | | |
//subConnSH OnConnStatus : No sub --------------+ | | | | |
//subListener OnUpdate : No sub -----------+ | | | | | |
string counterResult1 = TestUtil.checkCounters(0, 0, 0, 0, 0, 0, 10);
Assertion.Assert(counterResult1, counterResult1 == TestUtil.TU_OK);
}