| 127 | } |
| 128 | |
| 129 | void test_connect_range() |
| 130 | { |
| 131 | connection_sink sink; |
| 132 | boost::asio::io_context io_context; |
| 133 | boost::asio::ip::tcp::socket socket(io_context); |
| 134 | std::vector<boost::asio::ip::tcp::endpoint> endpoints; |
| 135 | boost::asio::ip::tcp::endpoint result; |
| 136 | |
| 137 | try |
| 138 | { |
| 139 | result = boost::asio::connect(socket, endpoints); |
| 140 | BOOST_ASIO_CHECK(false); |
| 141 | } |
| 142 | catch (boost::system::system_error& e) |
| 143 | { |
| 144 | BOOST_ASIO_CHECK(e.code() == boost::asio::error::not_found); |
| 145 | } |
| 146 | |
| 147 | endpoints.push_back(sink.target_endpoint()); |
| 148 | |
| 149 | result = boost::asio::connect(socket, endpoints); |
| 150 | BOOST_ASIO_CHECK(result == endpoints[0]); |
| 151 | |
| 152 | endpoints.push_back(sink.target_endpoint()); |
| 153 | |
| 154 | result = boost::asio::connect(socket, endpoints); |
| 155 | BOOST_ASIO_CHECK(result == endpoints[0]); |
| 156 | |
| 157 | endpoints.insert(endpoints.begin(), boost::asio::ip::tcp::endpoint()); |
| 158 | |
| 159 | result = boost::asio::connect(socket, endpoints); |
| 160 | BOOST_ASIO_CHECK(result == endpoints[1]); |
| 161 | } |
| 162 | |
| 163 | void test_connect_range_ec() |
| 164 | { |