12
12
#include < sstream>
13
13
14
14
using namespace cucumber ::internal;
15
- using namespace boost ::asio::ip;
16
- #if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
17
- using namespace boost ::asio::local;
18
- #endif
19
15
using namespace testing ;
20
16
21
17
static const auto THREAD_TEST_TIMEOUT = std::chrono::milliseconds(4000 );
@@ -94,7 +90,7 @@ class TCPSocketServerTest : public SocketServerTest {
94
90
95
91
TEST_F (TCPSocketServerTest, exitsOnFirstConnectionClosed) {
96
92
// given
97
- tcp::iostream client (server->listenEndpoint ());
93
+ asio::ip:: tcp::iostream client (server->listenEndpoint ());
98
94
ASSERT_THAT (client, IsConnected ());
99
95
ASSERT_THAT (server->listenEndpoint ().address ().to_string (), std::string (" 0.0.0.0" ));
100
96
@@ -107,11 +103,11 @@ TEST_F(TCPSocketServerTest, exitsOnFirstConnectionClosed) {
107
103
108
104
TEST_F (TCPSocketServerTest, moreThanOneClientCanConnect) {
109
105
// given
110
- tcp::iostream client1 (server->listenEndpoint ());
106
+ asio::ip:: tcp::iostream client1 (server->listenEndpoint ());
111
107
ASSERT_THAT (client1, IsConnected ());
112
108
113
109
// when
114
- tcp::iostream client2 (server->listenEndpoint ());
110
+ asio::ip:: tcp::iostream client2 (server->listenEndpoint ());
115
111
116
112
// then
117
113
ASSERT_THAT (client2, IsConnected ());
@@ -126,7 +122,7 @@ TEST_F(TCPSocketServerTest, receiveAndSendsSingleLineMassages) {
126
122
}
127
123
128
124
// given
129
- tcp::iostream client (server->listenEndpoint ());
125
+ asio::ip:: tcp::iostream client (server->listenEndpoint ());
130
126
ASSERT_THAT (client, IsConnected ());
131
127
132
128
// when
@@ -145,7 +141,7 @@ class TCPSocketServerLocalhostTest : public SocketServerTest {
145
141
146
142
SocketServer* createListeningServer () override {
147
143
server.reset (new TCPSocketServer (&protocolHandler));
148
- server->listen (tcp::endpoint (boost:: asio::ip::address::from_string (" 127.0.0.1" ), 0 ));
144
+ server->listen (asio::ip:: tcp::endpoint (asio::ip::address::from_string (" 127.0.0.1" ), 0 ));
149
145
return server.get ();
150
146
}
151
147
@@ -156,7 +152,7 @@ class TCPSocketServerLocalhostTest : public SocketServerTest {
156
152
157
153
TEST_F (TCPSocketServerLocalhostTest, listensOnLocalhost) {
158
154
// given
159
- tcp::iostream client (server->listenEndpoint ());
155
+ asio::ip:: tcp::iostream client (server->listenEndpoint ());
160
156
ASSERT_THAT (client, IsConnected ());
161
157
ASSERT_THAT (server->listenEndpoint ().address ().to_string (), std::string (" 127.0.0.1" ));
162
158
@@ -167,7 +163,7 @@ TEST_F(TCPSocketServerLocalhostTest, listensOnLocalhost) {
167
163
EXPECT_THAT (serverThread, EventuallyTerminates ());
168
164
}
169
165
170
- #if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS )
166
+ #if defined(ASIO_HAS_LOCAL_SOCKETS )
171
167
class UnixSocketServerTest : public SocketServerTest {
172
168
protected:
173
169
std::unique_ptr<UnixSocketServer> server;
@@ -204,14 +200,14 @@ class UnixSocketServerTest : public SocketServerTest {
204
200
* created at startup and removed on shutdown.
205
201
*/
206
202
TEST_F (UnixSocketServerTest, fullLifecycle) {
207
- stream_protocol::endpoint socketName = server->listenEndpoint ();
203
+ asio::local:: stream_protocol::endpoint socketName = server->listenEndpoint ();
208
204
EXPECT_CALL (protocolHandler, handle (" X" )).WillRepeatedly (Return (" Y" ));
209
205
210
206
// socket created at startup
211
207
ASSERT_TRUE (std::filesystem::exists (socketName.path ()));
212
208
213
209
// traffic flows
214
- stream_protocol::iostream client (socketName);
210
+ asio::local:: stream_protocol::iostream client (socketName);
215
211
client << " X" << std::endl << std::flush;
216
212
EXPECT_THAT (client, EventuallyReceives (" Y" ));
217
213
0 commit comments