@@ -130,46 +130,3 @@ TEST_CASE("Ensure general utility functions work", "[utility]") {
130130 std::string joined = netkit::utility::join (tokens, " ," );
131131 REQUIRE (joined == to_split);
132132}
133-
134- TEST_CASE (" Ensure basic sockets work" , " [socket]" ) {
135- std::thread t ([]() {
136- netkit::sock::addr addr (" 127.0.0.1" , 1337 , netkit::sock::addr_type::ipv4);
137- netkit::sock::sync_sock sock (addr, netkit::sock::type::tcp);
138-
139- sock.bind ();
140- sock.listen ();
141-
142- while (true ) {
143- auto result = sock.recv (-1 );
144- if (result.status != netkit::sock::recv_status::success) {
145- return ;
146- }
147-
148- if (result.status == netkit::sock::recv_status::success) {
149- std::string data = result.data ;
150- REQUIRE (data == " Hello, World!" );
151- sock.send (" Hello, World!" );
152- }
153- }
154-
155- sock.unbind ();
156- });
157- t.detach ();
158-
159- std::this_thread::sleep_for (std::chrono::milliseconds (1000 ));
160-
161- netkit::sock::addr addr (" 127.0.0.1" , 1337 , netkit::sock::addr_type::ipv4);
162- netkit::sock::sync_sock sock (addr, netkit::sock::type::tcp);
163-
164- sock.connect ();
165- sock.send (" Hello, World!" );
166- auto result = sock.recv (-1 );
167- if (result.status == netkit::sock::recv_status::success) {
168- std::string data = result.data ;
169- REQUIRE (data == " Hello, World!" );
170- } else {
171- REQUIRE (false ); // fail the test if we didn't receive a response
172- }
173-
174- t.join ();
175- }
0 commit comments