MCPcopy Create free account
hub / github.com/apache/thrift / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

lib/cpp/test/TSSLSocketInterruptTest.cpp:140–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140BOOST_AUTO_TEST_CASE(test_ssl_interruptable_child_read_while_handshaking) {
141 shared_ptr<TSSLSocketFactory> pServerSocketFactory = createServerSocketFactory();
142 TSSLServerSocket sock1("localhost", 0, pServerSocketFactory);
143 sock1.listen();
144 int port = sock1.getPort();
145 shared_ptr<TSSLSocketFactory> pClientSocketFactory = createClientSocketFactory();
146 shared_ptr<TSSLSocket> clientSock = pClientSocketFactory->createSocket("localhost", port);
147 clientSock->open();
148 shared_ptr<TTransport> accepted = sock1.accept();
149 boost::thread readThread(std::bind(readerWorkerMustThrow, accepted));
150 boost::this_thread::sleep(boost::posix_time::milliseconds(50));
151 // readThread is practically guaranteed to be blocking now
152 sock1.interruptChildren();
153 BOOST_CHECK_MESSAGE(readThread.try_join_for(boost::chrono::milliseconds(20)),
154 "server socket interruptChildren did not interrupt child read");
155 clientSock->close();
156 accepted->close();
157 sock1.close();
158}
159
160BOOST_AUTO_TEST_CASE(test_ssl_interruptable_child_read) {
161 shared_ptr<TSSLSocketFactory> pServerSocketFactory = createServerSocketFactory();

Callers

nothing calls this directly

Calls 14

acceptMethod · 0.65
closeMethod · 0.65
writeMethod · 0.65
bindFunction · 0.50
listenMethod · 0.45
getPortMethod · 0.45
createSocketMethod · 0.45
openMethod · 0.45
interruptChildrenMethod · 0.45

Tested by

no test coverage detected