Skip to content

Commit

Permalink
Fix KeepAliveTest.SSLClientReconnectionPost (#1895)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmy-park authored Aug 10, 2024
1 parent 390f2c4 commit 6c3e848
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5167,8 +5167,14 @@ TEST(KeepAliveTest, SSLClientReconnectionPost) {
res.set_content("Hello World!", "text/plain");
});

auto f = std::async(std::launch::async, [&svr] { svr.listen(HOST, PORT); });
std::this_thread::sleep_for(std::chrono::milliseconds(200));
auto listen_thread = std::thread([&svr] { svr.listen(HOST, PORT); });
auto se = detail::scope_exit([&] {
svr.stop();
listen_thread.join();
ASSERT_FALSE(svr.is_running());
});

svr.wait_until_ready();

SSLClient cli(HOST, PORT);
cli.enable_server_certificate_verification(false);
Expand Down Expand Up @@ -5206,9 +5212,6 @@ TEST(KeepAliveTest, SSLClientReconnectionPost) {
"text/plain");
ASSERT_TRUE(result);
EXPECT_EQ(200, result->status);

svr.stop();
f.wait();
}
#endif

Expand Down

0 comments on commit 6c3e848

Please sign in to comment.