How is people around here testing code which uses ASIO? I guess something like GIVEN("SOMETHING THAT STARTS BY DOING A NAME RESOLVER IS STARTED") fakeResolver.async_resolve("www.google.com", "80", HandlerCallingConnect); // This stores the completion handler (and an executor_work_guard) internally WHEN("THE RESOLVER RETURNS WITHOUT ERROR") fakeResolver.completeWithFakeResult("1.2.3.4", error_code()); // This post() the completion handler with the arguments you give it here io_context.poll(); THEN("A CONNECTION IS ATTEMPTED") EXPECT_CALL(fakeSocket, async_connect()); would be nice. But the "stores the completion handler" part doesn't look that simple. I have found some attempts online, but they seems to store the completion handlers into a vector of std::function and post them through std::bind, so possibly using the wrong executor, etc. There is any good set of ASIO I/O object fakes available?