本文整理汇总了C++中Error::Code方法的典型用法代码示例。如果您正苦于以下问题:C++ Error::Code方法的具体用法?C++ Error::Code怎么用?C++ Error::Code使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Error
的用法示例。
在下文中一共展示了Error::Code方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cl
// Connect - Disconnect from Server in back thread
TEST_F(WSClientServerConnectionTest, DisconnectFromServerBT) {
MockHandler ch;
WSClient cl(ch);
MockHandler sh;
WSServer sv(sh);
Error e = sv.Start(TEST_ADDR, TEST_PORT);
ASSERT_EQ(LNR_OK, e.Code());
WSSocket cs = cl.CreateSocket(TEST_ADDR, TEST_PORT);
{
InSequence dummy;
EXPECT_CALL(sh, OnConnectMock(_)).WillOnce(WithArg<0>(Disconnect()));
EXPECT_CALL(sh, OnDisconnectMock(Eq(ByRef(sh.s_)), Error(LNR_OK))).WillOnce(Assign(&srv_finished, true));
}
{
InSequence dummy;
// never called OnConnect: fail handshake
EXPECT_CALL(ch, OnDisconnectMock(cs, Error(LNR_ECONNRESET))).WillOnce(Assign(&cli_finished, true));;
}
e = cs.Connect();
ASSERT_EQ(LNR_OK, e.Code());
WAIT_TO_FINISH_CALLBACK();
}
示例2: context
// Connect EINVAL
TEST_F(SSLClientServerConnectionTest, ConnectEinval) {
MockHandler ch;
SSLContext context(SSLContext::TLSv1_1);
context.SetCertificate(std::string(CLIENT_CERT));
context.SetPrivateKey(std::string(CLIENT_PKEY));
context.SetCAFile(std::string(CA_CERT));
context.SetCiphers(std::string(CIPHER_LIST));
context.SetVerifyMode(SSLContext::VERIFY_PEER);
SSLClient cl(ch, context);
MockHandler sh;
SSLContext server_context(SSLContext::TLSv1_1);
server_context.SetCertificate(std::string(SERVER_CERT));
server_context.SetPrivateKey(std::string(SERVER_PKEY));
server_context.SetCAFile(std::string(CA_CERT));
server_context.SetCiphers(std::string(CIPHER_LIST));
server_context.SetVerifyMode(SSLContext::VERIFY_PEER);
SSLServer sv(sh, server_context);
Error e = sv.Start(TEST_ADDR, TEST_PORT);
ASSERT_EQ(LNR_OK, e.Code());
SSLSocket cs = cl.CreateSocket(TEST_ADDR, TEST_PORT);
EXPECT_CALL(sh, OnConnectMock(_)).WillOnce(Assign(&srv_finished, true));
EXPECT_CALL(ch, OnConnectMock(cs)).WillOnce(Assign(&cli_finished, true));
e = cs.Connect();
ASSERT_EQ(LNR_OK, e.Code());
WAIT_TO_FINISH_CALLBACK();
e = sh.s_.Connect();
ASSERT_EQ(LNR_EINVAL, e.Code());
}