title: How to unit test a call-back function? (C++ Boost Unit test)
body: <p>I want to unit test a client/server function. The client calls the server, the server calls a callback function. Something like:</p>
  
  <pre><code>void CallBack()
  {
      BOOST_SUCCESS(); // test is successful if this is called
  }
  
  BOOST_AUTO_TEST_CASE( ConnectionTest_ClientCallback )
  {
      CallServer(); // server will do work and call CallBack()
      sleep(20);
      BOOST_FAIL("Server hasn't called CallBack() within specified time limit.");
  }
  </code></pre>
  
  <p>But the above won't work because CallBack() could be called during any of the tests. Is there a better way to do this?</p>