/// @brief Handler invoked when data have been received over the socket.
///
+ /// This is the handler invoked when the data have been received over the
+ /// socket. If custom response has been specified, this response is sent
+ /// back to the client. Otherwise, the handler echoes back the request
+ /// and prepends the word "received ". Finally, it calls a custom
+ /// callback function (specified in the constructor) to notify that the
+ /// response has been sent over the socket.
+ ///
/// @param bytes_transferred Number of bytes received.
void
readHandler(const boost::system::error_code&, size_t bytes_transferred) {
class ConnectionPool;
/// @brief Provides unix domain socket functionality for unit tests.
+///
+/// This class represents a server side socket. It can be used to
+/// test client's transmission over the unix domain socket. By default,
+/// the server side socket echoes the client's message so the client's
+/// message (prefixed with the word "received").
+///
+/// It is also possible to specify a custom response from the server
+/// instead of eachoing back the request.
+///
+/// It is possible to make multiple connections to the server side
+/// socket simultaneously.
+///
+/// The test should perform IOService::run_one until it finds that
+/// the number of responses sent by the server is greater than
+/// expected. The number of responses sent so far can be retrieved
+/// using @ref TestServerUnixSocket::getResponseNum.
class TestServerUnixSocket {
public:
TestServerUnixSocket(IOService& io_service,
const std::string& socket_file_path,
const long test_timeout,
- const std::string& custom_respons_ = "");
+ const std::string& custom_response = "");
/// @brief Destructor.
///