face: move createChannel overloads that take strings to unit tests

They are used only there.

Change-Id: I0c70221bbcad36024223cc6e3c929b9c08b683c0
diff --git a/tests/daemon/face/tcp-factory.t.cpp b/tests/daemon/face/tcp-factory.t.cpp
index c6fee2f..39567d6 100644
--- a/tests/daemon/face/tcp-factory.t.cpp
+++ b/tests/daemon/face/tcp-factory.t.cpp
@@ -29,11 +29,23 @@
 #include "factory-test-common.hpp"
 #include "tests/limited-io.hpp"
 
+#include <ndn-cxx/net/address-converter.hpp>
+
 namespace nfd {
 namespace face {
 namespace tests {
 
-using TcpFactoryFixture = FaceSystemFactoryFixture<TcpFactory>;
+class TcpFactoryFixture : public FaceSystemFactoryFixture<TcpFactory>
+{
+protected:
+  shared_ptr<TcpChannel>
+  createChannel(const std::string& localIp, const std::string& localPort)
+  {
+    tcp::Endpoint endpoint(ndn::ip::addressFromString(localIp),
+                           boost::lexical_cast<uint16_t>(localPort));
+    return factory.createChannel(endpoint);
+  }
+};
 
 BOOST_AUTO_TEST_SUITE(Face)
 BOOST_FIXTURE_TEST_SUITE(TestTcpFactory, TcpFactoryFixture)
@@ -134,23 +146,23 @@
   BOOST_CHECK_EQUAL(factory.getChannels().empty(), true);
 
   std::set<std::string> expected;
-  expected.insert(factory.createChannel("127.0.0.1", "20070")->getUri().toString());
-  expected.insert(factory.createChannel("127.0.0.1", "20071")->getUri().toString());
-  expected.insert(factory.createChannel("::1", "20071")->getUri().toString());
+  expected.insert(createChannel("127.0.0.1", "20070")->getUri().toString());
+  expected.insert(createChannel("127.0.0.1", "20071")->getUri().toString());
+  expected.insert(createChannel("::1", "20071")->getUri().toString());
   checkChannelListEqual(factory, expected);
 }
 
 BOOST_AUTO_TEST_CASE(CreateChannel)
 {
-  auto channel1 = factory.createChannel("127.0.0.1", "20070");
-  auto channel1a = factory.createChannel("127.0.0.1", "20070");
+  auto channel1 = createChannel("127.0.0.1", "20070");
+  auto channel1a = createChannel("127.0.0.1", "20070");
   BOOST_CHECK_EQUAL(channel1, channel1a);
   BOOST_CHECK_EQUAL(channel1->getUri().toString(), "tcp4://127.0.0.1:20070");
 
-  auto channel2 = factory.createChannel("127.0.0.1", "20071");
+  auto channel2 = createChannel("127.0.0.1", "20071");
   BOOST_CHECK_NE(channel1, channel2);
 
-  auto channel3 = factory.createChannel("::1", "20071");
+  auto channel3 = createChannel("::1", "20071");
   BOOST_CHECK_NE(channel2, channel3);
   BOOST_CHECK_EQUAL(channel3->getUri().toString(), "tcp6://[::1]:20071");
 }
@@ -165,7 +177,7 @@
              false,
              {CreateFaceExpectedResult::FAILURE, 504, "No channels available to connect"});
 
-  factory.createChannel("127.0.0.1", "20071");
+  createChannel("127.0.0.1", "20071");
 
   createFace(factory,
              FaceUri("tcp4://127.0.0.1:6363"),
@@ -202,7 +214,7 @@
 
 BOOST_AUTO_TEST_CASE(UnsupportedCreateFace)
 {
-  factory.createChannel("127.0.0.1", "20071");
+  createChannel("127.0.0.1", "20071");
 
   createFace(factory,
              FaceUri("tcp4://127.0.0.1:20072"),
@@ -259,7 +271,7 @@
 
 BOOST_FIXTURE_TEST_CASE(CreateFaceTimeout, CreateFaceTimeoutFixture)
 {
-  factory.createChannel("0.0.0.0", "20070");
+  createChannel("0.0.0.0", "20070");
 
   factory.createFace({FaceUri("tcp4://192.0.2.1:20070"), {},
                       ndn::nfd::FACE_PERSISTENCY_PERSISTENT, false, false},
diff --git a/tests/daemon/face/udp-factory.t.cpp b/tests/daemon/face/udp-factory.t.cpp
index 2747fa8..ce4d17e 100644
--- a/tests/daemon/face/udp-factory.t.cpp
+++ b/tests/daemon/face/udp-factory.t.cpp
@@ -31,12 +31,23 @@
 
 #include <boost/algorithm/string/replace.hpp>
 #include <boost/range/algorithm/count_if.hpp>
+#include <ndn-cxx/net/address-converter.hpp>
 
 namespace nfd {
 namespace face {
 namespace tests {
 
-using UdpFactoryFixture = FaceSystemFactoryFixture<UdpFactory>;
+class UdpFactoryFixture : public FaceSystemFactoryFixture<UdpFactory>
+{
+protected:
+  shared_ptr<UdpChannel>
+  createChannel(const std::string& localIp, const std::string& localPort)
+  {
+    udp::Endpoint endpoint(ndn::ip::addressFromString(localIp),
+                           boost::lexical_cast<uint16_t>(localPort));
+    return factory.createChannel(endpoint, time::minutes(5));
+  }
+};
 
 BOOST_AUTO_TEST_SUITE(Face)
 BOOST_FIXTURE_TEST_SUITE(TestUdpFactory, UdpFactoryFixture)
@@ -495,28 +506,28 @@
   BOOST_CHECK_EQUAL(factory.getChannels().empty(), true);
 
   std::set<std::string> expected;
-  expected.insert(factory.createChannel("127.0.0.1", "20070")->getUri().toString());
-  expected.insert(factory.createChannel("127.0.0.1", "20071")->getUri().toString());
-  expected.insert(factory.createChannel("::1", "20071")->getUri().toString());
+  expected.insert(createChannel("127.0.0.1", "20070")->getUri().toString());
+  expected.insert(createChannel("127.0.0.1", "20071")->getUri().toString());
+  expected.insert(createChannel("::1", "20071")->getUri().toString());
   checkChannelListEqual(factory, expected);
 }
 
 BOOST_AUTO_TEST_CASE(CreateChannel)
 {
-  auto channel1 = factory.createChannel("127.0.0.1", "20070");
-  auto channel1a = factory.createChannel("127.0.0.1", "20070");
+  auto channel1 = createChannel("127.0.0.1", "20070");
+  auto channel1a = createChannel("127.0.0.1", "20070");
   BOOST_CHECK_EQUAL(channel1, channel1a);
   BOOST_CHECK_EQUAL(channel1->getUri().toString(), "udp4://127.0.0.1:20070");
 
-  auto channel2 = factory.createChannel("127.0.0.1", "20071");
+  auto channel2 = createChannel("127.0.0.1", "20071");
   BOOST_CHECK_NE(channel1, channel2);
 
-  auto channel3 = factory.createChannel("::1", "20071");
+  auto channel3 = createChannel("::1", "20071");
   BOOST_CHECK_NE(channel2, channel3);
   BOOST_CHECK_EQUAL(channel3->getUri().toString(), "udp6://[::1]:20071");
 
   // createChannel with multicast address
-  BOOST_CHECK_EXCEPTION(factory.createChannel("224.0.0.1", "20070"), UdpFactory::Error,
+  BOOST_CHECK_EXCEPTION(createChannel("224.0.0.1", "20070"), UdpFactory::Error,
                         [] (const UdpFactory::Error& e) {
                           return strcmp(e.what(),
                                         "createChannel is only for unicast channels. The provided endpoint "
@@ -525,7 +536,7 @@
 
   // createChannel with a local endpoint that has already been allocated for a UDP multicast face
   auto multicastFace = factory.createMulticastFace("127.0.0.1", "224.0.0.1", "20072");
-  BOOST_CHECK_EXCEPTION(factory.createChannel("127.0.0.1", "20072"), UdpFactory::Error,
+  BOOST_CHECK_EXCEPTION(createChannel("127.0.0.1", "20072"), UdpFactory::Error,
                         [] (const UdpFactory::Error& e) {
                           return strcmp(e.what(),
                                         "Cannot create the requested UDP unicast channel, local "
@@ -540,7 +551,7 @@
   BOOST_CHECK_EQUAL(multicastFace1, multicastFace1a);
 
   // createMulticastFace with a local endpoint that is already used by a channel
-  auto channel = factory.createChannel("127.0.0.1", "20071");
+  auto channel = createChannel("127.0.0.1", "20071");
   BOOST_CHECK_EXCEPTION(factory.createMulticastFace("127.0.0.1", "224.0.0.1", "20071"), UdpFactory::Error,
                         [] (const UdpFactory::Error& e) {
                           return strcmp(e.what(),
@@ -595,7 +606,7 @@
              false,
              {CreateFaceExpectedResult::FAILURE, 504, "No channels available to connect"});
 
-  factory.createChannel("127.0.0.1", "20071");
+  createChannel("127.0.0.1", "20071");
 
   createFace(factory,
              FaceUri("udp4://127.0.0.1:6363"),
@@ -633,7 +644,7 @@
 
 BOOST_AUTO_TEST_CASE(UnsupportedCreateFace)
 {
-  factory.createChannel("127.0.0.1", "20071");
+  createChannel("127.0.0.1", "20071");
 
   createFace(factory,
              FaceUri("udp4://127.0.0.1:20072"),
diff --git a/tests/daemon/face/websocket-factory.t.cpp b/tests/daemon/face/websocket-factory.t.cpp
index 380646e..d813931 100644
--- a/tests/daemon/face/websocket-factory.t.cpp
+++ b/tests/daemon/face/websocket-factory.t.cpp
@@ -28,13 +28,23 @@
 #include "face-system-fixture.hpp"
 #include "factory-test-common.hpp"
 
+#include <ndn-cxx/net/address-converter.hpp>
+
 namespace nfd {
 namespace face {
 namespace tests {
 
-namespace ip = boost::asio::ip;
-
-using WebSocketFactoryFixture = FaceSystemFactoryFixture<WebSocketFactory>;
+class WebSocketFactoryFixture : public FaceSystemFactoryFixture<WebSocketFactory>
+{
+protected:
+  shared_ptr<WebSocketChannel>
+  createChannel(const std::string& localIp, const std::string& localPort)
+  {
+    websocket::Endpoint endpoint(ndn::ip::addressFromString(localIp),
+                                 boost::lexical_cast<uint16_t>(localPort));
+    return factory.createChannel(endpoint);
+  }
+};
 
 BOOST_AUTO_TEST_SUITE(Face)
 BOOST_FIXTURE_TEST_SUITE(TestWebSocketFactory, WebSocketFactoryFixture)
@@ -175,9 +185,9 @@
   BOOST_CHECK_EQUAL(factory.getChannels().empty(), true);
 
   std::set<std::string> expected;
-  expected.insert(factory.createChannel("127.0.0.1", "20070")->getUri().toString());
-  expected.insert(factory.createChannel("127.0.0.1", "20071")->getUri().toString());
-  expected.insert(factory.createChannel("::1", "20071")->getUri().toString());
+  expected.insert(createChannel("127.0.0.1", "20070")->getUri().toString());
+  expected.insert(createChannel("127.0.0.1", "20071")->getUri().toString());
+  expected.insert(createChannel("::1", "20071")->getUri().toString());
   checkChannelListEqual(factory, expected);
 }