| 165 | |
| 166 | #if defined(ASIO_HAS_LOCAL_SOCKETS) |
| 167 | class UnixSocketServerTest : public SocketServerTest { |
| 168 | protected: |
| 169 | std::unique_ptr<UnixSocketServer> server; |
| 170 | |
| 171 | SocketServer* createListeningServer() override { |
| 172 | const std::string filename = std::filesystem::temp_directory_path() / randomString(); |
| 173 | server.reset(new UnixSocketServer(&protocolHandler)); |
| 174 | server->listen(filename); |
| 175 | return server.get(); |
| 176 | } |
| 177 | |
| 178 | void destroyListeningServer() override { |
| 179 | server.reset(); |
| 180 | } |
| 181 | |
| 182 | private: |
| 183 | std::random_device rd{}; |
| 184 | std::mt19937 gen{rd()}; |
| 185 | std::uniform_int_distribution<> distrib{0, 15}; |
| 186 | |
| 187 | std::string randomString() { |
| 188 | std::stringstream out{}; |
| 189 | for (std::size_t i = 0; i < 16; i++) |
| 190 | out << std::hex << distrib(gen); |
| 191 | return out.str(); |
| 192 | } |
| 193 | }; |
| 194 | |
| 195 | /* |
| 196 | * Tests are flickering on OSX when testing without traffic flowing. |
nothing calls this directly
no outgoing calls
no test coverage detected