本文整理汇总了C++中TestThriftServerFactory类的典型用法代码示例。如果您正苦于以下问题:C++ TestThriftServerFactory类的具体用法?C++ TestThriftServerFactory怎么用?C++ TestThriftServerFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestThriftServerFactory类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: TEST
TEST(ThriftServer, CompressionClientTest) {
TestThriftServerFactory<TestInterface> factory;
ScopedServerThread sst(factory.create());
folly::EventBase base;
std::shared_ptr<TAsyncSocket> socket(
TAsyncSocket::newSocket(&base, *sst.getAddress()));
TestServiceAsyncClient client(
std::unique_ptr<HeaderClientChannel,
folly::DelayedDestruction::Destructor>(
new HeaderClientChannel(socket)));
auto channel =
boost::polymorphic_downcast<HeaderClientChannel*>(client.getChannel());
channel->setTransform(apache::thrift::transport::THeader::ZLIB_TRANSFORM);
channel->setMinCompressBytes(1);
std::string response;
client.sync_sendResponse(response, 64);
EXPECT_EQ(response, "test64");
auto trans = channel->getWriteTransforms();
EXPECT_EQ(trans.size(), 1);
for (auto& tran : trans) {
EXPECT_EQ(tran, apache::thrift::transport::THeader::ZLIB_TRANSFORM);
}
}
开发者ID:JoesRain,项目名称:fbthrift,代码行数:27,代码来源:ThriftServerTest.cpp
示例2: TEST
TEST(ThriftServer, IdleServerTimeout) {
TestThriftServerFactory<TestInterface> factory;
auto server = factory.create();
auto thriftServer = dynamic_cast<ThriftServer *>(server.get());
thriftServer->setIdleServerTimeout(std::chrono::milliseconds(50));
ScopedServerThread scopedServer(server);
scopedServer.join();
}
开发者ID:ConfusedReality,项目名称:pkg_serialization_fbthrift,代码行数:10,代码来源:ThriftServerTest.cpp
示例3: TEST
TEST(ThriftServer, BadSendTest) {
TestThriftServerFactory<TestInterface> factory;
ScopedServerThread sst(factory.create());
folly::EventBase base;
std::shared_ptr<TAsyncSocket> socket(
TAsyncSocket::newSocket(&base, *sst.getAddress()));
TestServiceAsyncClient client(HeaderClientChannel::newChannel(socket));
client.sendResponse(std::unique_ptr<RequestCallback>(new Callback), 64);
socket->shutdownWriteNow();
base.loop();
std::string response;
EXPECT_THROW(client.sync_sendResponse(response, 64), TTransportException);
}
开发者ID:majinlion,项目名称:fbthrift,代码行数:17,代码来源:ThriftServerTest.cpp
注:本文中的TestThriftServerFactory类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论