blob: 76af381c5e1247e80398372d5d612f1449489b6b [file] [log] [blame]
Junxiao Shi77dcadd2014-10-05 14:40:54 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Yanbiao Liac8b4ca2017-07-10 02:27:50 -07002/*
Davide Pesavento2e481fc2021-07-02 18:20:03 -04003 * Copyright (c) 2013-2021 Regents of the University of California,
Junxiao Shid5c2f0c2017-04-04 09:52:11 +00004 * Arizona Board of Regents,
5 * Colorado State University,
6 * University Pierre & Marie Curie, Sorbonne University,
7 * Washington University in St. Louis,
8 * Beijing Institute of Technology,
9 * The University of Memphis.
Junxiao Shi77dcadd2014-10-05 14:40:54 -070010 *
11 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
12 *
13 * ndn-cxx library is free software: you can redistribute it and/or modify it under the
14 * terms of the GNU Lesser General Public License as published by the Free Software
15 * Foundation, either version 3 of the License, or (at your option) any later version.
16 *
17 * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
18 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
19 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
20 *
21 * You should have received copies of the GNU General Public License and GNU Lesser
22 * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
23 * <http://www.gnu.org/licenses/>.
24 *
25 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
26 */
27
Davide Pesavento7e780642018-11-24 15:51:34 -050028#include "ndn-cxx/net/face-uri.hpp"
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050029#include "ndn-cxx/net/network-interface.hpp"
30#include "ndn-cxx/net/network-monitor.hpp"
Junxiao Shi77dcadd2014-10-05 14:40:54 -070031
Davide Pesavento7e780642018-11-24 15:51:34 -050032#include "tests/boost-test.hpp"
Davide Pesavento7e780642018-11-24 15:51:34 -050033#include "tests/unit/net/network-configuration-detector.hpp"
Junxiao Shi77dcadd2014-10-05 14:40:54 -070034
35namespace ndn {
Alexander Afanasyev1286e022015-01-26 10:42:29 -080036namespace tests {
37
Junxiao Shi25467942017-06-30 02:53:14 +000038BOOST_AUTO_TEST_SUITE(Net)
Davide Pesaventoeee3e822016-11-26 19:19:34 +010039BOOST_AUTO_TEST_SUITE(TestFaceUri)
Junxiao Shi77dcadd2014-10-05 14:40:54 -070040
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050041class CanonizeFixture
Junxiao Shi4083c8d2014-10-12 16:43:16 -070042{
43protected:
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050044 CanonizeFixture()
45 {
46 static const auto netifs = [this] {
47 net::NetworkMonitor netmon(m_io);
48 if (netmon.getCapabilities() & net::NetworkMonitor::CAP_ENUM) {
49 netmon.onEnumerationCompleted.connect([this] { m_io.stop(); });
50 m_io.run();
51#if BOOST_VERSION >= 106600
52 m_io.restart();
53#else
54 m_io.reset();
55#endif
56 }
57 return netmon.listNetworkInterfaces();
58 }();
59
60 if (!netifs.empty()) {
61 m_netif = netifs.front();
62 }
63 }
64
Junxiao Shi4083c8d2014-10-12 16:43:16 -070065 void
Davide Pesaventoe1081cd2016-12-19 23:58:15 -050066 addTest(const std::string& request, bool shouldSucceed, const std::string& expectedUri)
67 {
68 ++m_nPending;
69 auto tc = make_shared<CanonizeTestCase>(request, shouldSucceed, expectedUri);
70
71 FaceUri uri(request);
Davide Pesavento2e481fc2021-07-02 18:20:03 -040072 uri.canonize(std::bind(&CanonizeFixture::onCanonizeSuccess, this, tc, _1),
73 std::bind(&CanonizeFixture::onCanonizeFailure, this, tc, _1),
Davide Pesavento0f830802018-01-16 23:58:58 -050074 m_io, 10_s);
Davide Pesaventoe1081cd2016-12-19 23:58:15 -050075 }
Junxiao Shi4083c8d2014-10-12 16:43:16 -070076
77 void
78 runTests()
79 {
80 m_io.run();
81 BOOST_CHECK_EQUAL(m_nPending, 0);
82 }
83
84private:
Davide Pesavento50df5622015-03-19 22:05:05 +010085 class CanonizeTestCase
Junxiao Shi4083c8d2014-10-12 16:43:16 -070086 {
87 public:
Davide Pesaventoe1081cd2016-12-19 23:58:15 -050088 CanonizeTestCase(const std::string& request, bool shouldSucceed, const std::string& expectedUri)
89 : m_expectedUri(expectedUri)
Davide Pesavento50df5622015-03-19 22:05:05 +010090 , m_message(request + " should " + (shouldSucceed ? "succeed" : "fail"))
Davide Pesaventoe1081cd2016-12-19 23:58:15 -050091 , m_shouldSucceed(shouldSucceed)
Junxiao Shi4083c8d2014-10-12 16:43:16 -070092 , m_isCompleted(false)
93 {
94 }
95
96 public:
Junxiao Shi4083c8d2014-10-12 16:43:16 -070097 std::string m_expectedUri;
Davide Pesavento50df5622015-03-19 22:05:05 +010098 std::string m_message;
Davide Pesaventoe1081cd2016-12-19 23:58:15 -050099 bool m_shouldSucceed;
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700100 bool m_isCompleted;
101 };
102
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700103 void
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500104 onCanonizeSuccess(const shared_ptr<CanonizeTestCase>& tc, const FaceUri& canonicalUri)
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700105 {
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500106 BOOST_CHECK_EQUAL(tc->m_isCompleted, false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700107 tc->m_isCompleted = true;
108 --m_nPending;
109
Davide Pesavento50df5622015-03-19 22:05:05 +0100110 BOOST_CHECK_MESSAGE(tc->m_shouldSucceed, tc->m_message);
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500111 if (tc->m_shouldSucceed) {
112 BOOST_CHECK_EQUAL(canonicalUri.toString(), tc->m_expectedUri);
113 }
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700114 }
115
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700116 void
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500117 onCanonizeFailure(const shared_ptr<CanonizeTestCase>& tc, const std::string& reason)
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700118 {
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500119 BOOST_CHECK_EQUAL(tc->m_isCompleted, false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700120 tc->m_isCompleted = true;
121 --m_nPending;
122
Davide Pesavento50df5622015-03-19 22:05:05 +0100123 BOOST_CHECK_MESSAGE(!tc->m_shouldSucceed, tc->m_message);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700124 }
125
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500126protected:
127 shared_ptr<const net::NetworkInterface> m_netif;
128
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700129private:
130 boost::asio::io_service m_io;
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500131 ssize_t m_nPending = 0;
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700132};
133
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700134BOOST_AUTO_TEST_CASE(ParseInternal)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700135{
136 FaceUri uri;
137
138 BOOST_CHECK(uri.parse("internal://"));
139 BOOST_CHECK_EQUAL(uri.getScheme(), "internal");
140 BOOST_CHECK_EQUAL(uri.getHost(), "");
141 BOOST_CHECK_EQUAL(uri.getPort(), "");
142 BOOST_CHECK_EQUAL(uri.getPath(), "");
143
144 BOOST_CHECK_EQUAL(uri.parse("internal:"), false);
145 BOOST_CHECK_EQUAL(uri.parse("internal:/"), false);
146}
147
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700148BOOST_AUTO_TEST_CASE(ParseUdp)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700149{
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500150 FaceUri uri("udp://hostname:6363");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700151 BOOST_CHECK_THROW(FaceUri("udp//hostname:6363"), FaceUri::Error);
152 BOOST_CHECK_THROW(FaceUri("udp://hostname:port"), FaceUri::Error);
153
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700154 BOOST_CHECK_EQUAL(uri.parse("udp//hostname:6363"), false);
155
156 BOOST_CHECK(uri.parse("udp://hostname:80"));
157 BOOST_CHECK_EQUAL(uri.getScheme(), "udp");
158 BOOST_CHECK_EQUAL(uri.getHost(), "hostname");
159 BOOST_CHECK_EQUAL(uri.getPort(), "80");
160 BOOST_CHECK_EQUAL(uri.getPath(), "");
161
162 BOOST_CHECK(uri.parse("udp4://192.0.2.1:20"));
163 BOOST_CHECK_EQUAL(uri.getScheme(), "udp4");
164 BOOST_CHECK_EQUAL(uri.getHost(), "192.0.2.1");
165 BOOST_CHECK_EQUAL(uri.getPort(), "20");
166 BOOST_CHECK_EQUAL(uri.getPath(), "");
167
168 BOOST_CHECK(uri.parse("udp6://[2001:db8:3f9:0::1]:6363"));
169 BOOST_CHECK_EQUAL(uri.getScheme(), "udp6");
170 BOOST_CHECK_EQUAL(uri.getHost(), "2001:db8:3f9:0::1");
171 BOOST_CHECK_EQUAL(uri.getPort(), "6363");
172 BOOST_CHECK_EQUAL(uri.getPath(), "");
173
174 BOOST_CHECK(uri.parse("udp6://[2001:db8:3f9:0:3025:ccc5:eeeb:86d3]:6363"));
175 BOOST_CHECK_EQUAL(uri.getScheme(), "udp6");
176 BOOST_CHECK_EQUAL(uri.getHost(), "2001:db8:3f9:0:3025:ccc5:eeeb:86d3");
177 BOOST_CHECK_EQUAL(uri.getPort(), "6363");
178 BOOST_CHECK_EQUAL(uri.getPath(), "");
179
180 BOOST_CHECK_EQUAL(uri.parse("udp6://[2001:db8:3f9:0:3025:ccc5:eeeb:86dg]:6363"), false);
181
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500182 namespace ip = boost::asio::ip;
183
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700184 ip::udp::endpoint endpoint4(ip::address_v4::from_string("192.0.2.1"), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500185 uri = FaceUri(endpoint4);
186 BOOST_CHECK_EQUAL(uri.toString(), "udp4://192.0.2.1:7777");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700187
188 ip::udp::endpoint endpoint6(ip::address_v6::from_string("2001:DB8::1"), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500189 uri = FaceUri(endpoint6);
190 BOOST_CHECK_EQUAL(uri.toString(), "udp6://[2001:db8::1]:7777");
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700191
192 BOOST_CHECK(uri.parse("udp6://[fe80::1%25eth1]:6363"));
193 BOOST_CHECK_EQUAL(uri.getHost(), "fe80::1%25eth1");
194
195 BOOST_CHECK(uri.parse("udp6://[fe80::1%eth1]:6363"));
196 BOOST_CHECK_EQUAL(uri.getHost(), "fe80::1%eth1");
197
198 BOOST_CHECK(uri.parse("udp6://[fe80::1%1]:6363"));
199 BOOST_CHECK(uri.parse("udp6://[fe80::1%eth1]"));
Davide Pesaventob984e322018-01-24 19:40:07 -0500200
201 BOOST_CHECK(uri.parse("udp6://[ff01::114%eth#1]"));
202 BOOST_CHECK(uri.parse("udp6://[ff01::114%eth.1,2]"));
203 BOOST_CHECK(uri.parse("udp6://[ff01::114%a+b-c=0]"));
204 BOOST_CHECK(uri.parse("udp6://[ff01::114%[foo]]"));
205 BOOST_CHECK(uri.parse("udp6://[ff01::114%]]"));
206 BOOST_CHECK(uri.parse("udp6://[ff01::114%%]"));
207 BOOST_CHECK(!uri.parse("udp6://[ff01::114%]"));
208 BOOST_CHECK(!uri.parse("udp6://[ff01::114%foo bar]"));
209 BOOST_CHECK(!uri.parse("udp6://[ff01::114%foo/bar]"));
210 BOOST_CHECK(!uri.parse("udp6://[ff01::114%eth0:1]"));
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700211}
212
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500213BOOST_FIXTURE_TEST_CASE(IsCanonicalUdp, CanonizeFixture)
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700214{
215 BOOST_CHECK_EQUAL(FaceUri::canCanonize("udp"), true);
216 BOOST_CHECK_EQUAL(FaceUri::canCanonize("udp4"), true);
217 BOOST_CHECK_EQUAL(FaceUri::canCanonize("udp6"), true);
218
219 BOOST_CHECK_EQUAL(FaceUri("udp4://192.0.2.1:6363").isCanonical(), true);
220 BOOST_CHECK_EQUAL(FaceUri("udp://192.0.2.1:6363").isCanonical(), false);
221 BOOST_CHECK_EQUAL(FaceUri("udp4://192.0.2.1").isCanonical(), false);
222 BOOST_CHECK_EQUAL(FaceUri("udp4://192.0.2.1:6363/").isCanonical(), false);
223 BOOST_CHECK_EQUAL(FaceUri("udp6://[2001:db8::1]:6363").isCanonical(), true);
224 BOOST_CHECK_EQUAL(FaceUri("udp6://[2001:db8::01]:6363").isCanonical(), false);
Eric Newberry71aecae2017-05-29 00:22:39 -0700225 BOOST_CHECK_EQUAL(FaceUri("udp://[2001:db8::1]:6363").isCanonical(), false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700226 BOOST_CHECK_EQUAL(FaceUri("udp://example.net:6363").isCanonical(), false);
227 BOOST_CHECK_EQUAL(FaceUri("udp4://example.net:6363").isCanonical(), false);
228 BOOST_CHECK_EQUAL(FaceUri("udp6://example.net:6363").isCanonical(), false);
229 BOOST_CHECK_EQUAL(FaceUri("udp4://224.0.23.170:56363").isCanonical(), true);
Eric Newberry71aecae2017-05-29 00:22:39 -0700230 BOOST_CHECK_EQUAL(FaceUri("udp4://[2001:db8::1]:6363").isCanonical(), false);
231 BOOST_CHECK_EQUAL(FaceUri("udp6://192.0.2.1:6363").isCanonical(), false);
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700232
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500233 if (m_netif) {
234 auto name = m_netif->getName();
235 auto index = to_string(m_netif->getIndex());
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700236
237 BOOST_CHECK_EQUAL(FaceUri("udp6://[fe80::1%" + name + "]:6363").isCanonical(), true);
238 BOOST_CHECK_EQUAL(FaceUri("udp6://[fe80::1%" + index + "]:6363").isCanonical(), false);
239 BOOST_CHECK_EQUAL(FaceUri("udp6://[fe80::1%" + name + "]").isCanonical(), false);
240 BOOST_CHECK_EQUAL(FaceUri("udp6://[fe80::1068:dddb:fe26:fe3f%25en0]:6363").isCanonical(), false);
241 }
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800242}
243
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500244BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(CanonizeUdpV4, 1)
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800245BOOST_FIXTURE_TEST_CASE(CanonizeUdpV4, CanonizeFixture)
246{
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100247 SKIP_IF_IPV4_UNAVAILABLE();
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700248
249 // IPv4 unicast
250 addTest("udp4://192.0.2.1:6363", true, "udp4://192.0.2.1:6363");
251 addTest("udp://192.0.2.2:6363", true, "udp4://192.0.2.2:6363");
252 addTest("udp4://192.0.2.3", true, "udp4://192.0.2.3:6363");
253 addTest("udp4://192.0.2.4:6363/", true, "udp4://192.0.2.4:6363");
254 addTest("udp4://192.0.2.5:9695", true, "udp4://192.0.2.5:9695");
255 addTest("udp4://192.0.2.666:6363", false, "");
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500256 addTest("udp4://192.0.2.7:99999", false, ""); // Bug #3897
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700257 addTest("udp4://google-public-dns-a.google.com", true, "udp4://8.8.8.8:6363");
Davide Pesaventof78cb702016-12-11 14:42:40 -0500258 addTest("udp4://google-public-dns-a.google.com:70000", false, "");
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700259 addTest("udp4://invalid.invalid", false, "");
260
261 // IPv4 multicast
262 addTest("udp4://224.0.23.170:56363", true, "udp4://224.0.23.170:56363");
263 addTest("udp4://224.0.23.170", true, "udp4://224.0.23.170:56363");
264 addTest("udp4://all-routers.mcast.net:56363", true, "udp4://224.0.0.2:56363");
265
Eric Newberry71aecae2017-05-29 00:22:39 -0700266 // IPv6 used with udp4 protocol - not canonical
267 addTest("udp4://[2001:db8::1]:6363", false, "");
268
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800269 runTests();
270}
271
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500272BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(CanonizeUdpV6, 1)
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800273BOOST_FIXTURE_TEST_CASE(CanonizeUdpV6, CanonizeFixture)
274{
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100275 SKIP_IF_IPV6_UNAVAILABLE();
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800276
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700277 // IPv6 unicast
278 addTest("udp6://[2001:db8::1]:6363", true, "udp6://[2001:db8::1]:6363");
Davide Pesaventof78cb702016-12-11 14:42:40 -0500279 addTest("udp6://[2001:db8::1]", true, "udp6://[2001:db8::1]:6363");
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700280 addTest("udp://[2001:db8::1]:6363", true, "udp6://[2001:db8::1]:6363");
281 addTest("udp6://[2001:db8::01]:6363", true, "udp6://[2001:db8::1]:6363");
Davide Pesaventof78cb702016-12-11 14:42:40 -0500282 addTest("udp6://[2001::db8::1]:6363", false, "");
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500283 addTest("udp6://[2001:db8::1]:99999", false, ""); // Bug #3897
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700284 addTest("udp6://google-public-dns-a.google.com", true, "udp6://[2001:4860:4860::8888]:6363");
Davide Pesaventof78cb702016-12-11 14:42:40 -0500285 addTest("udp6://google-public-dns-a.google.com:70000", false, "");
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700286 addTest("udp6://invalid.invalid", false, "");
287 addTest("udp://invalid.invalid", false, "");
288
289 // IPv6 multicast
290 addTest("udp6://[ff02::2]:56363", true, "udp6://[ff02::2]:56363");
291 addTest("udp6://[ff02::2]", true, "udp6://[ff02::2]:56363");
292
Eric Newberry71aecae2017-05-29 00:22:39 -0700293 // IPv4 used with udp6 protocol - not canonical
294 addTest("udp6://192.0.2.1:6363", false, "");
295
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500296 if (m_netif) {
297 auto name = m_netif->getName();
298 auto index = to_string(m_netif->getIndex());
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700299
300 addTest("udp6://[fe80::1068:dddb:fe26:fe3f%25" + name + "]:6363", true,
301 "udp6://[fe80::1068:dddb:fe26:fe3f%" + name + "]:6363");
302
303 addTest("udp6://[fe80::1068:dddb:fe26:fe3f%" + index + "]:6363", true,
304 "udp6://[fe80::1068:dddb:fe26:fe3f%" + name + "]:6363");
305 }
306
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700307 runTests();
308}
309
310BOOST_AUTO_TEST_CASE(ParseTcp)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700311{
312 FaceUri uri;
313
314 BOOST_CHECK(uri.parse("tcp://random.host.name"));
315 BOOST_CHECK_EQUAL(uri.getScheme(), "tcp");
316 BOOST_CHECK_EQUAL(uri.getHost(), "random.host.name");
317 BOOST_CHECK_EQUAL(uri.getPort(), "");
318 BOOST_CHECK_EQUAL(uri.getPath(), "");
319
320 BOOST_CHECK_EQUAL(uri.parse("tcp://192.0.2.1:"), false);
321 BOOST_CHECK_EQUAL(uri.parse("tcp://[::zzzz]"), false);
322
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500323 namespace ip = boost::asio::ip;
324
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700325 ip::tcp::endpoint endpoint4(ip::address_v4::from_string("192.0.2.1"), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500326 uri = FaceUri(endpoint4);
327 BOOST_CHECK_EQUAL(uri.toString(), "tcp4://192.0.2.1:7777");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700328
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500329 uri = FaceUri(endpoint4, "wsclient");
330 BOOST_CHECK_EQUAL(uri.toString(), "wsclient://192.0.2.1:7777");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700331
332 ip::tcp::endpoint endpoint6(ip::address_v6::from_string("2001:DB8::1"), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500333 uri = FaceUri(endpoint6);
334 BOOST_CHECK_EQUAL(uri.toString(), "tcp6://[2001:db8::1]:7777");
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700335
336 BOOST_CHECK(uri.parse("tcp6://[fe80::1%25eth1]:6363"));
337 BOOST_CHECK_EQUAL(uri.getHost(), "fe80::1%25eth1");
338
339 BOOST_CHECK(uri.parse("tcp6://[fe80::1%eth1]:6363"));
340 BOOST_CHECK_EQUAL(uri.getHost(), "fe80::1%eth1");
341
342 BOOST_CHECK(uri.parse("tcp6://[fe80::1%1]:6363"));
343 BOOST_CHECK(uri.parse("tcp6://[fe80::1%eth1]"));
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700344}
345
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500346BOOST_FIXTURE_TEST_CASE(IsCanonicalTcp, CanonizeFixture)
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700347{
348 BOOST_CHECK_EQUAL(FaceUri::canCanonize("tcp"), true);
349 BOOST_CHECK_EQUAL(FaceUri::canCanonize("tcp4"), true);
350 BOOST_CHECK_EQUAL(FaceUri::canCanonize("tcp6"), true);
351
352 BOOST_CHECK_EQUAL(FaceUri("tcp4://192.0.2.1:6363").isCanonical(), true);
353 BOOST_CHECK_EQUAL(FaceUri("tcp://192.0.2.1:6363").isCanonical(), false);
354 BOOST_CHECK_EQUAL(FaceUri("tcp4://192.0.2.1").isCanonical(), false);
355 BOOST_CHECK_EQUAL(FaceUri("tcp4://192.0.2.1:6363/").isCanonical(), false);
356 BOOST_CHECK_EQUAL(FaceUri("tcp6://[2001:db8::1]:6363").isCanonical(), true);
357 BOOST_CHECK_EQUAL(FaceUri("tcp6://[2001:db8::01]:6363").isCanonical(), false);
Eric Newberry71aecae2017-05-29 00:22:39 -0700358 BOOST_CHECK_EQUAL(FaceUri("tcp://[2001:db8::1]:6363").isCanonical(), false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700359 BOOST_CHECK_EQUAL(FaceUri("tcp://example.net:6363").isCanonical(), false);
360 BOOST_CHECK_EQUAL(FaceUri("tcp4://example.net:6363").isCanonical(), false);
361 BOOST_CHECK_EQUAL(FaceUri("tcp6://example.net:6363").isCanonical(), false);
362 BOOST_CHECK_EQUAL(FaceUri("tcp4://224.0.23.170:56363").isCanonical(), false);
Eric Newberry71aecae2017-05-29 00:22:39 -0700363 BOOST_CHECK_EQUAL(FaceUri("tcp4://[2001:db8::1]:6363").isCanonical(), false);
364 BOOST_CHECK_EQUAL(FaceUri("tcp6://192.0.2.1:6363").isCanonical(), false);
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700365
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500366 if (m_netif) {
367 auto name = m_netif->getName();
368 auto index = to_string(m_netif->getIndex());
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700369
370 BOOST_CHECK_EQUAL(FaceUri("tcp6://[fe80::1%" + name + "]:6363").isCanonical(), true);
371 BOOST_CHECK_EQUAL(FaceUri("tcp6://[fe80::1%" + index + "]:6363").isCanonical(), false);
372 BOOST_CHECK_EQUAL(FaceUri("tcp6://[fe80::1%" + name + "]").isCanonical(), false);
373 BOOST_CHECK_EQUAL(FaceUri("tcp6://[fe80::1068:dddb:fe26:fe3f%25en0]:6363").isCanonical(), false);
374 }
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800375}
376
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500377BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(CanonizeTcpV4, 1)
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800378BOOST_FIXTURE_TEST_CASE(CanonizeTcpV4, CanonizeFixture)
379{
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100380 SKIP_IF_IPV4_UNAVAILABLE();
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700381
382 // IPv4 unicast
383 addTest("tcp4://192.0.2.1:6363", true, "tcp4://192.0.2.1:6363");
384 addTest("tcp://192.0.2.2:6363", true, "tcp4://192.0.2.2:6363");
385 addTest("tcp4://192.0.2.3", true, "tcp4://192.0.2.3:6363");
386 addTest("tcp4://192.0.2.4:6363/", true, "tcp4://192.0.2.4:6363");
387 addTest("tcp4://192.0.2.5:9695", true, "tcp4://192.0.2.5:9695");
388 addTest("tcp4://192.0.2.666:6363", false, "");
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500389 addTest("tcp4://192.0.2.7:99999", false, ""); // Bug #3897
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700390 addTest("tcp4://google-public-dns-a.google.com", true, "tcp4://8.8.8.8:6363");
Davide Pesaventof78cb702016-12-11 14:42:40 -0500391 addTest("tcp4://google-public-dns-a.google.com:70000", false, "");
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700392 addTest("tcp4://invalid.invalid", false, "");
393
394 // IPv4 multicast
395 addTest("tcp4://224.0.23.170:56363", false, "");
396 addTest("tcp4://224.0.23.170", false, "");
397 addTest("tcp4://all-routers.mcast.net:56363", false, "");
398
Eric Newberry71aecae2017-05-29 00:22:39 -0700399 // IPv6 used with tcp4 protocol - not canonical
400 addTest("tcp4://[2001:db8::1]:6363", false, "");
401
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500402 if (m_netif) {
403 auto name = m_netif->getName();
404 auto index = to_string(m_netif->getIndex());
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700405
406 addTest("tcp6://[fe80::1068:dddb:fe26:fe3f%25" + name + "]:6363", true,
407 "tcp6://[fe80::1068:dddb:fe26:fe3f%" + name + "]:6363");
408
409 addTest("tcp6://[fe80::1068:dddb:fe26:fe3f%" + index + "]:6363", true,
410 "tcp6://[fe80::1068:dddb:fe26:fe3f%" + name + "]:6363");
411 }
412
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800413 runTests();
414}
415
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500416BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(CanonizeTcpV6, 1)
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800417BOOST_FIXTURE_TEST_CASE(CanonizeTcpV6, CanonizeFixture)
418{
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100419 SKIP_IF_IPV6_UNAVAILABLE();
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800420
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700421 // IPv6 unicast
422 addTest("tcp6://[2001:db8::1]:6363", true, "tcp6://[2001:db8::1]:6363");
Davide Pesaventof78cb702016-12-11 14:42:40 -0500423 addTest("tcp6://[2001:db8::1]", true, "tcp6://[2001:db8::1]:6363");
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700424 addTest("tcp://[2001:db8::1]:6363", true, "tcp6://[2001:db8::1]:6363");
425 addTest("tcp6://[2001:db8::01]:6363", true, "tcp6://[2001:db8::1]:6363");
Davide Pesaventof78cb702016-12-11 14:42:40 -0500426 addTest("tcp6://[2001::db8::1]:6363", false, "");
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500427 addTest("tcp6://[2001:db8::1]:99999", false, ""); // Bug #3897
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700428 addTest("tcp6://google-public-dns-a.google.com", true, "tcp6://[2001:4860:4860::8888]:6363");
Davide Pesaventof78cb702016-12-11 14:42:40 -0500429 addTest("tcp6://google-public-dns-a.google.com:70000", false, "");
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700430 addTest("tcp6://invalid.invalid", false, "");
431 addTest("tcp://invalid.invalid", false, "");
432
433 // IPv6 multicast
434 addTest("tcp6://[ff02::2]:56363", false, "");
435 addTest("tcp6://[ff02::2]", false, "");
436
Eric Newberry71aecae2017-05-29 00:22:39 -0700437 // IPv4 used with tcp6 protocol - not canonical
438 addTest("tcp6://192.0.2.1:6363", false, "");
439
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700440 runTests();
441}
442
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500443BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(ParseUnix, 1)
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700444BOOST_AUTO_TEST_CASE(ParseUnix)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700445{
446 FaceUri uri;
447
448 BOOST_CHECK(uri.parse("unix:///var/run/example.sock"));
449 BOOST_CHECK_EQUAL(uri.getScheme(), "unix");
450 BOOST_CHECK_EQUAL(uri.getHost(), "");
451 BOOST_CHECK_EQUAL(uri.getPort(), "");
452 BOOST_CHECK_EQUAL(uri.getPath(), "/var/run/example.sock");
453
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500454 // This is not a valid unix:// URI, but the parse would treat "var" as host
455 BOOST_CHECK_EQUAL(uri.parse("unix://var/run/example.sock"), false); // Bug #3896
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700456
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500457#ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS
458 using boost::asio::local::stream_protocol;
459 stream_protocol::endpoint endpoint("/var/run/example.sock");
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500460 uri = FaceUri(endpoint);
461 BOOST_CHECK_EQUAL(uri.toString(), "unix:///var/run/example.sock");
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500462#endif // BOOST_ASIO_HAS_LOCAL_SOCKETS
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700463}
464
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700465BOOST_AUTO_TEST_CASE(ParseFd)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700466{
467 FaceUri uri;
468
469 BOOST_CHECK(uri.parse("fd://6"));
470 BOOST_CHECK_EQUAL(uri.getScheme(), "fd");
471 BOOST_CHECK_EQUAL(uri.getHost(), "6");
472 BOOST_CHECK_EQUAL(uri.getPort(), "");
473 BOOST_CHECK_EQUAL(uri.getPath(), "");
474
475 int fd = 21;
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500476 uri = FaceUri::fromFd(fd);
477 BOOST_CHECK_EQUAL(uri.toString(), "fd://21");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700478}
479
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700480BOOST_AUTO_TEST_CASE(ParseEther)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700481{
482 FaceUri uri;
483
484 BOOST_CHECK(uri.parse("ether://[08:00:27:01:dd:01]"));
485 BOOST_CHECK_EQUAL(uri.getScheme(), "ether");
486 BOOST_CHECK_EQUAL(uri.getHost(), "08:00:27:01:dd:01");
487 BOOST_CHECK_EQUAL(uri.getPort(), "");
488 BOOST_CHECK_EQUAL(uri.getPath(), "");
489
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700490 BOOST_CHECK_EQUAL(uri.parse("ether://[08:00:27:zz:dd:01]"), false);
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700491
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500492 auto address = ethernet::Address::fromString("33:33:01:01:01:01");
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500493 uri = FaceUri(address);
494 BOOST_CHECK_EQUAL(uri.toString(), "ether://[33:33:01:01:01:01]");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700495}
496
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700497BOOST_FIXTURE_TEST_CASE(CanonizeEther, CanonizeFixture)
498{
499 BOOST_CHECK_EQUAL(FaceUri::canCanonize("ether"), true);
500
501 BOOST_CHECK_EQUAL(FaceUri("ether://[08:00:27:01:01:01]").isCanonical(), true);
502 BOOST_CHECK_EQUAL(FaceUri("ether://[08:00:27:1:1:1]").isCanonical(), false);
503 BOOST_CHECK_EQUAL(FaceUri("ether://[08:00:27:01:01:01]/").isCanonical(), false);
504 BOOST_CHECK_EQUAL(FaceUri("ether://[33:33:01:01:01:01]").isCanonical(), true);
505
506 addTest("ether://[08:00:27:01:01:01]", true, "ether://[08:00:27:01:01:01]");
507 addTest("ether://[08:00:27:1:1:1]", true, "ether://[08:00:27:01:01:01]");
508 addTest("ether://[08:00:27:01:01:01]/", true, "ether://[08:00:27:01:01:01]");
509 addTest("ether://[33:33:01:01:01:01]", true, "ether://[33:33:01:01:01:01]");
510
511 runTests();
512}
513
Junxiao Shid5c2f0c2017-04-04 09:52:11 +0000514BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(ParseDev, 1)
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700515BOOST_AUTO_TEST_CASE(ParseDev)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700516{
517 FaceUri uri;
518
519 BOOST_CHECK(uri.parse("dev://eth0"));
520 BOOST_CHECK_EQUAL(uri.getScheme(), "dev");
521 BOOST_CHECK_EQUAL(uri.getHost(), "eth0");
522 BOOST_CHECK_EQUAL(uri.getPort(), "");
523 BOOST_CHECK_EQUAL(uri.getPath(), "");
524
Junxiao Shid5c2f0c2017-04-04 09:52:11 +0000525 BOOST_CHECK_EQUAL(uri.parse("dev://eth0:8888"), false); // Bug #3896
526
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700527 std::string ifname = "en1";
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500528 uri = FaceUri::fromDev(ifname);
Junxiao Shid5c2f0c2017-04-04 09:52:11 +0000529 BOOST_CHECK_EQUAL(uri.toString(), "dev://en1");
530}
531
532BOOST_AUTO_TEST_CASE(IsCanonicalDev)
533{
534 BOOST_CHECK_EQUAL(FaceUri::canCanonize("dev"), true);
535
536 BOOST_CHECK_EQUAL(FaceUri("dev://eth0").isCanonical(), true);
537 BOOST_CHECK_EQUAL(FaceUri("dev://").isCanonical(), false);
538 BOOST_CHECK_EQUAL(FaceUri("dev://eth0:8888").isCanonical(), false);
539 BOOST_CHECK_EQUAL(FaceUri("dev://eth0/").isCanonical(), false);
540 BOOST_CHECK_EQUAL(FaceUri("dev://eth0/A").isCanonical(), false);
541}
542
543BOOST_FIXTURE_TEST_CASE(CanonizeDev, CanonizeFixture)
544{
545 addTest("dev://eth0", true, "dev://eth0");
546 addTest("dev://", false, "");
547 addTest("dev://eth0:8888", false, "");
548 addTest("dev://eth0/", true, "dev://eth0");
549 addTest("dev://eth0/A", false, "");
550
551 runTests();
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700552}
553
Weiwei Liud7f4fda2016-10-19 22:38:39 -0700554BOOST_AUTO_TEST_CASE(ParseUdpDev)
555{
556 FaceUri uri;
557
558 BOOST_CHECK(uri.parse("udp4+dev://eth0:7777"));
559 BOOST_CHECK_EQUAL(uri.getScheme(), "udp4+dev");
560 BOOST_CHECK_EQUAL(uri.getHost(), "eth0");
561 BOOST_CHECK_EQUAL(uri.getPort(), "7777");
562 BOOST_CHECK_EQUAL(uri.getPath(), "");
563
564 BOOST_CHECK(uri.parse("udp6+dev://eth1:7777"));
565 BOOST_CHECK_EQUAL(uri.getScheme(), "udp6+dev");
566 BOOST_CHECK_EQUAL(uri.getHost(), "eth1");
567 BOOST_CHECK_EQUAL(uri.getPort(), "7777");
568 BOOST_CHECK_EQUAL(uri.getPath(), "");
569
570 BOOST_CHECK(uri.parse("abc+efg://eth0"));
571 BOOST_CHECK(!uri.parse("abc+://eth0"));
572 BOOST_CHECK(!uri.parse("+abc://eth0"));
573
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500574 namespace ip = boost::asio::ip;
Weiwei Liud7f4fda2016-10-19 22:38:39 -0700575
576 ip::udp::endpoint endpoint4(ip::udp::v4(), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500577 uri = FaceUri::fromUdpDev(endpoint4, "en1");
578 BOOST_CHECK_EQUAL(uri.toString(), "udp4+dev://en1:7777");
Weiwei Liud7f4fda2016-10-19 22:38:39 -0700579
580 ip::udp::endpoint endpoint6(ip::udp::v6(), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500581 uri = FaceUri::fromUdpDev(endpoint6, "en2");
582 BOOST_CHECK_EQUAL(uri.toString(), "udp6+dev://en2:7777");
Weiwei Liud7f4fda2016-10-19 22:38:39 -0700583}
584
585BOOST_FIXTURE_TEST_CASE(CanonizeUdpDev, CanonizeFixture)
586{
587 BOOST_CHECK_EQUAL(FaceUri("udp4+dev://eth0:7777").isCanonical(), true);
588 BOOST_CHECK_EQUAL(FaceUri("udp6+dev://eth1:7777").isCanonical(), true);
589 BOOST_CHECK_EQUAL(FaceUri("udp+dev://eth1:7777").isCanonical(), false);
590 BOOST_CHECK_EQUAL(FaceUri("udp6+dev://eth1").isCanonical(), false);
591
592 addTest("udp4+dev://en0:7777", true, "udp4+dev://en0:7777");
593 addTest("udp6+dev://en0:7777", true, "udp6+dev://en0:7777");
594 addTest("udp+dev://en1:7777", false, "");
595 addTest("udp6+dev://en2", false, "");
596}
597
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700598BOOST_AUTO_TEST_CASE(CanonizeEmptyCallback)
599{
600 boost::asio::io_service io;
601
602 // unsupported scheme
603 FaceUri("null://").canonize(FaceUri::CanonizeSuccessCallback(),
604 FaceUri::CanonizeFailureCallback(),
Davide Pesavento0f830802018-01-16 23:58:58 -0500605 io, 1_ms);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700606
607 // cannot resolve
608 FaceUri("udp://192.0.2.333").canonize(FaceUri::CanonizeSuccessCallback(),
609 FaceUri::CanonizeFailureCallback(),
Davide Pesavento0f830802018-01-16 23:58:58 -0500610 io, 1_ms);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700611
612 // already canonical
613 FaceUri("udp4://192.0.2.1:6363").canonize(FaceUri::CanonizeSuccessCallback(),
614 FaceUri::CanonizeFailureCallback(),
Davide Pesavento0f830802018-01-16 23:58:58 -0500615 io, 1_ms);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700616
617 // need DNS resolution
618 FaceUri("udp://192.0.2.1:6363").canonize(FaceUri::CanonizeSuccessCallback(),
619 FaceUri::CanonizeFailureCallback(),
Davide Pesavento0f830802018-01-16 23:58:58 -0500620 io, 1_ms);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700621
622 io.run(); // should not crash
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100623
624 // avoid "test case [...] did not check any assertions" message from Boost.Test
625 BOOST_CHECK(true);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700626}
627
628BOOST_FIXTURE_TEST_CASE(CanonizeUnsupported, CanonizeFixture)
629{
630 BOOST_CHECK_EQUAL(FaceUri::canCanonize("internal"), false);
631 BOOST_CHECK_EQUAL(FaceUri::canCanonize("null"), false);
632 BOOST_CHECK_EQUAL(FaceUri::canCanonize("unix"), false);
633 BOOST_CHECK_EQUAL(FaceUri::canCanonize("fd"), false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700634
635 BOOST_CHECK_EQUAL(FaceUri("internal://").isCanonical(), false);
636 BOOST_CHECK_EQUAL(FaceUri("null://").isCanonical(), false);
637 BOOST_CHECK_EQUAL(FaceUri("unix:///var/run/nfd.sock").isCanonical(), false);
638 BOOST_CHECK_EQUAL(FaceUri("fd://0").isCanonical(), false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700639
640 addTest("internal://", false, "");
641 addTest("null://", false, "");
642 addTest("unix:///var/run/nfd.sock", false, "");
643 addTest("fd://0", false, "");
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700644
645 runTests();
646}
647
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700648BOOST_AUTO_TEST_CASE(Bug1635)
649{
650 FaceUri uri;
651
652 BOOST_CHECK(uri.parse("wsclient://[::ffff:76.90.11.239]:56366"));
653 BOOST_CHECK_EQUAL(uri.getScheme(), "wsclient");
654 BOOST_CHECK_EQUAL(uri.getHost(), "76.90.11.239");
655 BOOST_CHECK_EQUAL(uri.getPort(), "56366");
656 BOOST_CHECK_EQUAL(uri.getPath(), "");
657 BOOST_CHECK_EQUAL(uri.toString(), "wsclient://76.90.11.239:56366");
658}
659
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100660BOOST_AUTO_TEST_SUITE_END() // TestFaceUri
Junxiao Shi25467942017-06-30 02:53:14 +0000661BOOST_AUTO_TEST_SUITE_END() // Net
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700662
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800663} // namespace tests
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700664} // namespace ndn