diff --git a/src/detail/face-impl.hpp b/src/detail/face-impl.hpp
index 51aff16..44e6593 100644
--- a/src/detail/face-impl.hpp
+++ b/src/detail/face-impl.hpp
@@ -31,8 +31,9 @@
 #include "../lp/tags.hpp"
 #include "../mgmt/nfd/command-options.hpp"
 #include "../mgmt/nfd/controller.hpp"
-#include "../transport/tcp-transport.hpp"
-#include "../transport/unix-transport.hpp"
+#include "../transport/transport.hpp"
+// #include "../transport/tcp-transport.hpp"
+// #include "../transport/unix-transport.hpp"
 #include "../util/config-file.hpp"
 #include "../util/logger.hpp"
 #include "../util/scheduler.hpp"
@@ -371,8 +372,7 @@
   ensureConnected(bool wantResume)
   {
     if (!m_face.m_transport->isConnected())
-      m_face.m_transport->connect(m_face.getIoService(),
-                                  [=] (const Block& wire) { m_face.onReceiveElement(wire); });
+      m_face.m_transport->connect([=] (const Block& wire) { m_face.onReceiveElement(wire); });
 
     if (wantResume && !m_face.m_transport->isReceiving()) {
       m_face.m_transport->resume();
diff --git a/src/face.cpp b/src/face.cpp
index aaf8b63..555024f 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -62,36 +62,24 @@
 {
 }
 
+Face::Face(DummyIoService& ioService)
+  : m_impl(new Impl(*this))
+{
+  construct(nullptr, ns3::ndn::StackHelper::getKeyChain());
+}
+
 Face::Face(shared_ptr<Transport> transport)
   : m_impl(new Impl(*this))
 {
   construct(transport, ns3::ndn::StackHelper::getKeyChain());
 }
 
-Face::Face(boost::asio::io_service& ioService)
-  : m_impl(new Impl(*this))
-{
-  construct(nullptr, ns3::ndn::StackHelper::getKeyChain());
-}
-
 Face::Face(shared_ptr<Transport> transport, KeyChain& keyChain)
   : m_impl(new Impl(*this))
 {
   construct(std::move(transport), keyChain);
 }
 
-Face::Face(shared_ptr<Transport> transport, boost::asio::io_service& ioService)
-  : m_impl(new Impl(*this))
-{
-  construct(transport, ns3::ndn::StackHelper::getKeyChain());
-}
-
-Face::Face(shared_ptr<Transport> transport, boost::asio::io_service& ioService, KeyChain& keyChain)
-  : m_impl(new Impl(*this))
-{
-  construct(std::move(transport), keyChain);
-}
-
 shared_ptr<Transport>
 Face::makeDefaultTransport()
 {
diff --git a/src/face.hpp b/src/face.hpp
index 99f6b5c..1909460 100644
--- a/src/face.hpp
+++ b/src/face.hpp
@@ -122,20 +122,6 @@
 
 public: // constructors
   /**
-   * @brief Create Face using given transport (or default transport if omitted)
-   * @param transport the transport for lower layer communication. If nullptr,
-   *                  a default transport will be used. The default transport is
-   *                  determined from a FaceUri in NDN_CLIENT_TRANSPORT environ,
-   *                  a FaceUri in configuration file 'transport' key, or UnixTransport.
-   *
-   * @throw ConfigFile::Error @p transport is nullptr, and the configuration file cannot be
-   *                          parsed or specifies an unsupported protocol
-   * @note shared_ptr is passed by value because ownership is shared with this class
-   */
-  explicit
-  Face(shared_ptr<Transport> transport = nullptr);
-
-  /**
    * @brief Create Face using default transport and given io_service
    *
    * Usage examples:
@@ -164,7 +150,21 @@
    * @throw ConfigFile::Error the configuration file cannot be parsed or specifies an unsupported protocol
    */
   explicit
-  Face(boost::asio::io_service& ioService);
+  Face(DummyIoService& ioService);
+
+  /**
+   * @brief Create Face using given transport (or default transport if omitted)
+   * @param transport the transport for lower layer communication. If nullptr,
+   *                  a default transport will be used. The default transport is
+   *                  determined from a FaceUri in NDN_CLIENT_TRANSPORT environ,
+   *                  a FaceUri in configuration file 'transport' key, or UnixTransport.
+   *
+   * @throw ConfigFile::Error @p transport is nullptr, and the configuration file cannot be
+   *                          parsed or specifies an unsupported protocol
+   * @note shared_ptr is passed by value because ownership is shared with this class
+   */
+  explicit
+  Face(shared_ptr<Transport> transport = nullptr);
 
   /**
    * @brief Create Face using given transport and KeyChain
@@ -180,37 +180,6 @@
    */
   Face(shared_ptr<Transport> transport, KeyChain& keyChain);
 
-  /**
-   * @brief Create Face using given transport and IO service
-   * @param transport the transport for lower layer communication. If nullptr,
-   *                  a default transport will be used.
-   * @param ioService the io_service that controls all IO operations
-   *
-   * @sa Face(boost::asio::io_service&)
-   * @sa Face(shared_ptr<Transport>)
-   *
-   * @throw ConfigFile::Error @p transport is nullptr, and the configuration file cannot be
-   *                          parsed or specifies an unsupported protocol
-   * @note shared_ptr is passed by value because ownership is shared with this class
-   */
-  Face(shared_ptr<Transport> transport, boost::asio::io_service& ioService);
-
-  /**
-   * @brief Create a new Face using given Transport and IO service
-   * @param transport the transport for lower layer communication. If nullptr,
-   *                  a default transport will be used.
-   * @param ioService the io_service that controls all IO operations
-   * @param keyChain the KeyChain to sign commands
-   *
-   * @sa Face(boost::asio::io_service&)
-   * @sa Face(shared_ptr<Transport>, KeyChain&)
-   *
-   * @throw ConfigFile::Error @p transport is nullptr, and the configuration file cannot be
-   *                          parsed or specifies an unsupported protocol
-   * @note shared_ptr is passed by value because ownership is shared with this class
-   */
-  Face(shared_ptr<Transport> transport, boost::asio::io_service& ioService, KeyChain& keyChain);
-
   virtual
   ~Face();
 
@@ -459,10 +428,11 @@
   /**
    * @brief Return nullptr (cannot use IoService in simulations), preserved for API compatibility
    */
-  boost::asio::io_service&
+  DummyIoService&
   getIoService()
   {
-    return *static_cast<boost::asio::io_service*>(nullptr);
+    static DummyIoService io;
+    return io;
   }
 
 NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED:
diff --git a/src/ims/in-memory-storage-fifo.cpp b/src/ims/in-memory-storage-fifo.cpp
index df6e173..b151ed0 100644
--- a/src/ims/in-memory-storage-fifo.cpp
+++ b/src/ims/in-memory-storage-fifo.cpp
@@ -28,7 +28,7 @@
 {
 }
 
-InMemoryStorageFifo::InMemoryStorageFifo(boost::asio::io_service& ioService, size_t limit)
+InMemoryStorageFifo::InMemoryStorageFifo(DummyIoService& ioService, size_t limit)
   : InMemoryStorage(ioService, limit)
 {
 }
diff --git a/src/ims/in-memory-storage-fifo.hpp b/src/ims/in-memory-storage-fifo.hpp
index 6991451..dd88b74 100644
--- a/src/ims/in-memory-storage-fifo.hpp
+++ b/src/ims/in-memory-storage-fifo.hpp
@@ -39,7 +39,7 @@
   InMemoryStorageFifo(size_t limit = 10);
 
   explicit
-  InMemoryStorageFifo(boost::asio::io_service& ioService, size_t limit = 10);
+  InMemoryStorageFifo(DummyIoService& ioService, size_t limit = 10);
 
 NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED:
   /** @brief Removes one Data packet from in-memory storage based on FIFO
diff --git a/src/ims/in-memory-storage-lfu.cpp b/src/ims/in-memory-storage-lfu.cpp
index a155f60..41345e1 100644
--- a/src/ims/in-memory-storage-lfu.cpp
+++ b/src/ims/in-memory-storage-lfu.cpp
@@ -28,7 +28,7 @@
 {
 }
 
-InMemoryStorageLfu::InMemoryStorageLfu(boost::asio::io_service& ioService, size_t limit)
+InMemoryStorageLfu::InMemoryStorageLfu(DummyIoService& ioService, size_t limit)
   : InMemoryStorage(ioService, limit)
 {
 }
diff --git a/src/ims/in-memory-storage-lfu.hpp b/src/ims/in-memory-storage-lfu.hpp
index 7633cfd..ebc9711 100644
--- a/src/ims/in-memory-storage-lfu.hpp
+++ b/src/ims/in-memory-storage-lfu.hpp
@@ -43,7 +43,7 @@
   InMemoryStorageLfu(size_t limit = 10);
 
   explicit
-  InMemoryStorageLfu(boost::asio::io_service& ioService, size_t limit = 10);
+  InMemoryStorageLfu(DummyIoService& ioService, size_t limit = 10);
 
 NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED:
   /** @brief Removes one Data packet from in-memory storage based on LFU, i.e. evict the least
diff --git a/src/ims/in-memory-storage-lru.cpp b/src/ims/in-memory-storage-lru.cpp
index 22c463d..61eff85 100644
--- a/src/ims/in-memory-storage-lru.cpp
+++ b/src/ims/in-memory-storage-lru.cpp
@@ -28,7 +28,7 @@
 {
 }
 
-InMemoryStorageLru::InMemoryStorageLru(boost::asio::io_service& ioService,
+InMemoryStorageLru::InMemoryStorageLru(DummyIoService& ioService,
                                        size_t limit)
   : InMemoryStorage(ioService, limit)
 {
diff --git a/src/ims/in-memory-storage-lru.hpp b/src/ims/in-memory-storage-lru.hpp
index 3dd9dfe..67ce33a 100644
--- a/src/ims/in-memory-storage-lru.hpp
+++ b/src/ims/in-memory-storage-lru.hpp
@@ -40,7 +40,7 @@
   explicit
   InMemoryStorageLru(size_t limit = 10);
 
-  InMemoryStorageLru(boost::asio::io_service& ioService, size_t limit = 10);
+  InMemoryStorageLru(DummyIoService& ioService, size_t limit = 10);
 
 NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED:
   /** @brief Removes one Data packet from in-memory storage based on LRU, i.e. evict the least
diff --git a/src/ims/in-memory-storage-persistent.cpp b/src/ims/in-memory-storage-persistent.cpp
index ff6a3a9..716addb 100644
--- a/src/ims/in-memory-storage-persistent.cpp
+++ b/src/ims/in-memory-storage-persistent.cpp
@@ -28,7 +28,7 @@
 {
 }
 
-InMemoryStoragePersistent::InMemoryStoragePersistent(boost::asio::io_service& ioService)
+InMemoryStoragePersistent::InMemoryStoragePersistent(DummyIoService& ioService)
   : InMemoryStorage(ioService)
 {
 }
diff --git a/src/ims/in-memory-storage-persistent.hpp b/src/ims/in-memory-storage-persistent.hpp
index 5920ef3..a458a40 100644
--- a/src/ims/in-memory-storage-persistent.hpp
+++ b/src/ims/in-memory-storage-persistent.hpp
@@ -35,7 +35,7 @@
   InMemoryStoragePersistent();
 
   explicit
-  InMemoryStoragePersistent(boost::asio::io_service& ioService);
+  InMemoryStoragePersistent(DummyIoService& ioService);
 
 NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED:
   /** @brief Do nothing.
diff --git a/src/ims/in-memory-storage.cpp b/src/ims/in-memory-storage.cpp
index 0dc7df7..ec9876f 100644
--- a/src/ims/in-memory-storage.cpp
+++ b/src/ims/in-memory-storage.cpp
@@ -88,7 +88,7 @@
   init();
 }
 
-InMemoryStorage::InMemoryStorage(boost::asio::io_service& ioService, size_t limit)
+InMemoryStorage::InMemoryStorage(DummyIoService& ioService, size_t limit)
   : m_limit(limit)
   , m_nPackets(0)
 {
diff --git a/src/ims/in-memory-storage.hpp b/src/ims/in-memory-storage.hpp
index 9e61e7a..9850187 100644
--- a/src/ims/in-memory-storage.hpp
+++ b/src/ims/in-memory-storage.hpp
@@ -115,7 +115,7 @@
    *  The InMemoryStorage created through this method will handle MustBeFresh in interest processing
    */
   explicit
-  InMemoryStorage(boost::asio::io_service& ioService,
+  InMemoryStorage(DummyIoService& ioService,
                   size_t limit = std::numeric_limits<size_t>::max());
 
   /** @note Please make sure to implement it to free m_freeEntries and evict
diff --git a/src/net/asio-fwd.hpp b/src/net/asio-fwd.hpp
index fb80ee5..788b19d 100644
--- a/src/net/asio-fwd.hpp
+++ b/src/net/asio-fwd.hpp
@@ -22,19 +22,13 @@
 #ifndef NDN_NET_ASIO_FWD_HPP
 #define NDN_NET_ASIO_FWD_HPP
 
-#include <boost/version.hpp>
+namespace ndn {
 
-namespace boost {
-namespace asio {
+class DummyIoService
+{
+public:
+};
 
-#if BOOST_VERSION >= 106600
-class io_context;
-using io_service = io_context;
-#else
-class io_service;
-#endif // BOOST_VERSION >= 106600
-
-} // namespace asio
-} // namespace boost
+} // namespace ndn
 
 #endif // NDN_NET_ASIO_FWD_HPP
diff --git a/src/net/dns.cpp b/src/net/dns.cpp
deleted file mode 100644
index 0043ec9..0000000
--- a/src/net/dns.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2017 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#include "dns.hpp"
-#include "../util/scheduler.hpp"
-
-#include <boost/asio/io_service.hpp>
-#include <boost/asio/ip/udp.hpp>
-
-namespace ndn {
-namespace dns {
-
-class Resolver : noncopyable
-{
-public:
-  typedef boost::asio::ip::udp protocol;
-  typedef protocol::resolver::iterator iterator;
-  typedef protocol::resolver::query query;
-
-public:
-  Resolver(boost::asio::io_service& ioService,
-           const AddressSelector& addressSelector)
-    : m_resolver(ioService)
-    , m_addressSelector(addressSelector)
-    , m_scheduler(ioService)
-  {
-    BOOST_ASSERT(m_addressSelector != nullptr);
-  }
-
-  void
-  asyncResolve(const query& q,
-               const SuccessCallback& onSuccess,
-               const ErrorCallback& onError,
-               time::nanoseconds timeout,
-               const shared_ptr<Resolver>& self)
-  {
-    m_onSuccess = onSuccess;
-    m_onError = onError;
-
-    m_resolver.async_resolve(q, bind(&Resolver::onResolveResult, this, _1, _2, self));
-
-    m_resolveTimeout = m_scheduler.scheduleEvent(timeout, bind(&Resolver::onResolveTimeout, this, self));
-  }
-
-  iterator
-  syncResolve(const query& q)
-  {
-    return selectAddress(m_resolver.resolve(q));
-  }
-
-private:
-  void
-  onResolveResult(const boost::system::error_code& error,
-                  iterator it, const shared_ptr<Resolver>& self)
-  {
-    m_scheduler.cancelEvent(m_resolveTimeout);
-    // ensure the Resolver isn't destructed while callbacks are still pending, see #2653
-    m_resolver.get_io_service().post(bind([] (const shared_ptr<Resolver>&) {}, self));
-
-    if (error) {
-      if (error == boost::asio::error::operation_aborted)
-        return;
-
-      if (m_onError)
-        m_onError("Hostname cannot be resolved: " + error.message());
-
-      return;
-    }
-
-    it = selectAddress(it);
-
-    if (it != iterator() && m_onSuccess) {
-      m_onSuccess(it->endpoint().address());
-    }
-    else if (m_onError) {
-      m_onError("No endpoints match the specified address selector");
-    }
-  }
-
-  void
-  onResolveTimeout(const shared_ptr<Resolver>& self)
-  {
-    m_resolver.cancel();
-    // ensure the Resolver isn't destructed while callbacks are still pending, see #2653
-    m_resolver.get_io_service().post(bind([] (const shared_ptr<Resolver>&) {}, self));
-
-    if (m_onError)
-      m_onError("Hostname resolution timed out");
-  }
-
-  iterator
-  selectAddress(iterator it) const
-  {
-    while (it != iterator() &&
-           !m_addressSelector(it->endpoint().address())) {
-      ++it;
-    }
-
-    return it;
-  }
-
-private:
-  protocol::resolver m_resolver;
-
-  AddressSelector m_addressSelector;
-  SuccessCallback m_onSuccess;
-  ErrorCallback m_onError;
-
-  util::scheduler::Scheduler m_scheduler;
-  util::scheduler::EventId m_resolveTimeout;
-};
-
-void
-asyncResolve(const std::string& host,
-             const SuccessCallback& onSuccess,
-             const ErrorCallback& onError,
-             boost::asio::io_service& ioService,
-             const AddressSelector& addressSelector,
-             time::nanoseconds timeout)
-{
-  auto resolver = make_shared<Resolver>(ref(ioService), addressSelector);
-  resolver->asyncResolve(Resolver::query(host, ""), onSuccess, onError, timeout, resolver);
-  // resolver will be destroyed when async operation finishes or ioService stops
-}
-
-IpAddress
-syncResolve(const std::string& host,
-            boost::asio::io_service& ioService,
-            const AddressSelector& addressSelector)
-{
-  Resolver resolver(ioService, addressSelector);
-  auto it = resolver.syncResolve(Resolver::query(host, ""));
-
-  if (it == Resolver::iterator()) {
-    BOOST_THROW_EXCEPTION(Error("No endpoints match the specified address selector"));
-  }
-
-  return it->endpoint().address();
-}
-
-} // namespace dns
-} // namespace ndn
diff --git a/src/net/dns.hpp b/src/net/dns.hpp
deleted file mode 100644
index 961e5bd..0000000
--- a/src/net/dns.hpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2013-2018 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#ifndef NDN_NET_DNS_HPP
-#define NDN_NET_DNS_HPP
-
-#include "asio-fwd.hpp"
-#include "../util/time.hpp"
-
-#include <boost/asio/ip/address.hpp>
-
-namespace ndn {
-namespace dns {
-
-typedef boost::asio::ip::address IpAddress;
-typedef function<bool (const IpAddress& address)> AddressSelector;
-
-struct AnyAddress
-{
-  bool
-  operator()(const IpAddress& address) const
-  {
-    return true;
-  }
-};
-
-struct Ipv4Only
-{
-  bool
-  operator()(const IpAddress& address) const
-  {
-    return address.is_v4();
-  }
-};
-
-struct Ipv6Only
-{
-  bool
-  operator()(const IpAddress& address) const
-  {
-    return address.is_v6();
-  }
-};
-
-struct Error : public std::runtime_error
-{
-  explicit
-  Error(const std::string& what)
-    : std::runtime_error(what)
-  {
-  }
-};
-
-typedef function<void (const IpAddress& address)> SuccessCallback;
-typedef function<void (const std::string& reason)> ErrorCallback;
-
-/** \brief Asynchronously resolve host
- *
- * If an address selector predicate is specified, then each resolved IP address
- * is checked against the predicate.
- *
- * Available address selector predicates:
- *
- * - dns::AnyAddress()
- * - dns::Ipv4Address()
- * - dns::Ipv6Address()
- *
- * \warning Even after the DNS resolution has timed out, it's possible that
- *          \p ioService keeps running and \p onSuccess is invoked at a later time.
- *          This could cause segmentation fault if \p onSuccess is deallocated.
- *          To stop the io_service, explicitly invoke \p ioService.stop().
- */
-void
-asyncResolve(const std::string& host,
-             const SuccessCallback& onSuccess,
-             const ErrorCallback& onError,
-             boost::asio::io_service& ioService,
-             const AddressSelector& addressSelector = AnyAddress(),
-             time::nanoseconds timeout = 4_s);
-
-/** \brief Synchronously resolve host
- *
- * If an address selector predicate is specified, then each resolved IP address
- * is checked against the predicate.
- *
- * Available address selector predicates:
- *
- * - dns::AnyAddress()
- * - dns::Ipv4Address()
- * - dns::Ipv6Address()
- */
-IpAddress
-syncResolve(const std::string& host,
-            boost::asio::io_service& ioService,
-            const AddressSelector& addressSelector = AnyAddress());
-
-} // namespace dns
-} // namespace ndn
-
-#endif // NDN_NET_DNS_HPP
diff --git a/src/net/face-uri.cpp b/src/net/face-uri.cpp
index 97fe0f7..c91add4 100644
--- a/src/net/face-uri.cpp
+++ b/src/net/face-uri.cpp
@@ -28,7 +28,7 @@
 #include "face-uri.hpp"
 
 #include "address-converter.hpp"
-#include "dns.hpp"
+// #include "dns.hpp"
 #include "util/string-helper.hpp"
 
 #include <boost/algorithm/string.hpp>
@@ -245,7 +245,7 @@
   canonize(const FaceUri& faceUri,
            const FaceUri::CanonizeSuccessCallback& onSuccess,
            const FaceUri::CanonizeFailureCallback& onFailure,
-           boost::asio::io_service& io, time::nanoseconds timeout) const = 0;
+           time::nanoseconds timeout) const = 0;
 };
 
 template<typename Protocol>
@@ -261,95 +261,97 @@
   bool
   isCanonical(const FaceUri& faceUri) const override
   {
-    if (faceUri.getPort().empty()) {
-      return false;
-    }
-    if (!faceUri.getPath().empty()) {
-      return false;
-    }
+    BOOST_THROW_EXCEPTION(std::runtime_error("IP host canonization not supported"));
+    // if (faceUri.getPort().empty()) {
+    //   return false;
+    // }
+    // if (!faceUri.getPath().empty()) {
+    //   return false;
+    // }
 
-    boost::system::error_code ec;
-    auto addr = ip::addressFromString(unescapeHost(faceUri.getHost()), ec);
-    if (ec) {
-      return false;
-    }
+    // boost::system::error_code ec;
+    // auto addr = ip::addressFromString(unescapeHost(faceUri.getHost()), ec);
+    // if (ec) {
+    //   return false;
+    // }
 
-    bool hasCorrectScheme = (faceUri.getScheme() == m_v4Scheme && addr.is_v4()) ||
-                            (faceUri.getScheme() == m_v6Scheme && addr.is_v6());
-    if (!hasCorrectScheme) {
-      return false;
-    }
+    // bool hasCorrectScheme = (faceUri.getScheme() == m_v4Scheme && addr.is_v4()) ||
+    //                         (faceUri.getScheme() == m_v6Scheme && addr.is_v6());
+    // if (!hasCorrectScheme) {
+    //   return false;
+    // }
 
-    auto checkAddressWithUri = [] (const boost::asio::ip::address& addr,
-                                   const FaceUri& faceUri) -> bool {
-      if (addr.is_v4() || !addr.to_v6().is_link_local()) {
-        return addr.to_string() == faceUri.getHost();
-      }
+    // auto checkAddressWithUri = [] (const boost::asio::ip::address& addr,
+    //                                const FaceUri& faceUri) -> bool {
+    //   if (addr.is_v4() || !addr.to_v6().is_link_local()) {
+    //     return addr.to_string() == faceUri.getHost();
+    //   }
 
-      std::vector<std::string> addrFields, faceUriFields;
-      std::string addrString = addr.to_string();
-      std::string faceUriString = faceUri.getHost();
+    //   std::vector<std::string> addrFields, faceUriFields;
+    //   std::string addrString = addr.to_string();
+    //   std::string faceUriString = faceUri.getHost();
 
-      boost::algorithm::split(addrFields, addrString, boost::is_any_of("%"));
-      boost::algorithm::split(faceUriFields, faceUriString, boost::is_any_of("%"));
-      if (addrFields.size() != 2 || faceUriFields.size() != 2) {
-        return false;
-      }
+    //   boost::algorithm::split(addrFields, addrString, boost::is_any_of("%"));
+    //   boost::algorithm::split(faceUriFields, faceUriString, boost::is_any_of("%"));
+    //   if (addrFields.size() != 2 || faceUriFields.size() != 2) {
+    //     return false;
+    //   }
 
-      if (faceUriFields[1].size() > 2 && faceUriFields[1].compare(0, 2, "25") == 0) {
-        // %25... is accepted, but not a canonical form
-        return false;
-      }
+    //   if (faceUriFields[1].size() > 2 && faceUriFields[1].compare(0, 2, "25") == 0) {
+    //     // %25... is accepted, but not a canonical form
+    //     return false;
+    //   }
 
-      return addrFields[0] == faceUriFields[0] &&
-             addrFields[1] == faceUriFields[1];
-    };
+    //   return addrFields[0] == faceUriFields[0] &&
+    //          addrFields[1] == faceUriFields[1];
+    // };
 
-    return checkAddressWithUri(addr, faceUri) && checkAddress(addr).first;
+    // return checkAddressWithUri(addr, faceUri) && checkAddress(addr).first;
   }
 
   void
   canonize(const FaceUri& faceUri,
            const FaceUri::CanonizeSuccessCallback& onSuccess,
            const FaceUri::CanonizeFailureCallback& onFailure,
-           boost::asio::io_service& io, time::nanoseconds timeout) const override
+           time::nanoseconds timeout) const override
   {
-    if (this->isCanonical(faceUri)) {
-      onSuccess(faceUri);
-      return;
-    }
+    BOOST_THROW_EXCEPTION(std::runtime_error("IP host canonization not supported"));
+    // if (this->isCanonical(faceUri)) {
+    //   onSuccess(faceUri);
+    //   return;
+    // }
 
-    // make a copy because caller may modify faceUri
-    auto uri = make_shared<FaceUri>(faceUri);
-    boost::system::error_code ec;
-    auto ipAddress = ip::addressFromString(unescapeHost(faceUri.getHost()), ec);
-    if (!ec) {
-      // No need to resolve IP address if host is already an IP
-      if ((faceUri.getScheme() == m_v4Scheme && !ipAddress.is_v4()) ||
-          (faceUri.getScheme() == m_v6Scheme && !ipAddress.is_v6())) {
-        return onFailure("IPv4/v6 mismatch");
-      }
+    // // make a copy because caller may modify faceUri
+    // auto uri = make_shared<FaceUri>(faceUri);
+    // boost::system::error_code ec;
+    // auto ipAddress = ip::addressFromString(unescapeHost(faceUri.getHost()), ec);
+    // if (!ec) {
+    //   // No need to resolve IP address if host is already an IP
+    //   if ((faceUri.getScheme() == m_v4Scheme && !ipAddress.is_v4()) ||
+    //       (faceUri.getScheme() == m_v6Scheme && !ipAddress.is_v6())) {
+    //     return onFailure("IPv4/v6 mismatch");
+    //   }
 
-      onDnsSuccess(uri, onSuccess, onFailure, ipAddress);
-    }
-    else {
-      dns::AddressSelector addressSelector;
-      if (faceUri.getScheme() == m_v4Scheme) {
-        addressSelector = dns::Ipv4Only();
-      }
-      else if (faceUri.getScheme() == m_v6Scheme) {
-        addressSelector = dns::Ipv6Only();
-      }
-      else {
-        BOOST_ASSERT(faceUri.getScheme() == m_baseScheme);
-        addressSelector = dns::AnyAddress();
-      }
+    //   onDnsSuccess(uri, onSuccess, onFailure, ipAddress);
+    // }
+    // else {
+    //   dns::AddressSelector addressSelector;
+    //   if (faceUri.getScheme() == m_v4Scheme) {
+    //     addressSelector = dns::Ipv4Only();
+    //   }
+    //   else if (faceUri.getScheme() == m_v6Scheme) {
+    //     addressSelector = dns::Ipv6Only();
+    //   }
+    //   else {
+    //     BOOST_ASSERT(faceUri.getScheme() == m_baseScheme);
+    //     addressSelector = dns::AnyAddress();
+    //   }
 
-      dns::asyncResolve(unescapeHost(faceUri.getHost()),
-        bind(&IpHostCanonizeProvider<Protocol>::onDnsSuccess, this, uri, onSuccess, onFailure, _1),
-        bind(&IpHostCanonizeProvider<Protocol>::onDnsFailure, this, uri, onFailure, _1),
-        io, addressSelector, timeout);
-    }
+    //   dns::asyncResolve(unescapeHost(faceUri.getHost()),
+    //     bind(&IpHostCanonizeProvider<Protocol>::onDnsSuccess, this, uri, onSuccess, onFailure, _1),
+    //     bind(&IpHostCanonizeProvider<Protocol>::onDnsFailure, this, uri, onFailure, _1),
+    //     io, addressSelector, timeout);
+    // }
   }
 
 protected:
@@ -366,54 +368,54 @@
   }
 
 private:
-  void
-  onDnsSuccess(const shared_ptr<FaceUri>& faceUri,
-               const FaceUri::CanonizeSuccessCallback& onSuccess,
-               const FaceUri::CanonizeFailureCallback& onFailure,
-               const dns::IpAddress& ipAddress) const
-  {
-    bool isOk = false;
-    std::string reason;
-    std::tie(isOk, reason) = this->checkAddress(ipAddress);
-    if (!isOk) {
-      return onFailure(reason);
-    }
+  // void
+  // onDnsSuccess(const shared_ptr<FaceUri>& faceUri,
+  //              const FaceUri::CanonizeSuccessCallback& onSuccess,
+  //              const FaceUri::CanonizeFailureCallback& onFailure,
+  //              const dns::IpAddress& ipAddress) const
+  // {
+  //   bool isOk = false;
+  //   std::string reason;
+  //   std::tie(isOk, reason) = this->checkAddress(ipAddress);
+  //   if (!isOk) {
+  //     return onFailure(reason);
+  //   }
 
-    uint16_t port = 0;
-    if (faceUri->getPort().empty()) {
-      port = ipAddress.is_multicast() ? m_defaultMulticastPort : m_defaultUnicastPort;
-    }
-    else {
-      try {
-        port = boost::lexical_cast<uint16_t>(faceUri->getPort());
-      }
-      catch (const boost::bad_lexical_cast&) {
-        return onFailure("invalid port number '" + faceUri->getPort() + "'");
-      }
-    }
+  //   uint16_t port = 0;
+  //   if (faceUri->getPort().empty()) {
+  //     port = ipAddress.is_multicast() ? m_defaultMulticastPort : m_defaultUnicastPort;
+  //   }
+  //   else {
+  //     try {
+  //       port = boost::lexical_cast<uint16_t>(faceUri->getPort());
+  //     }
+  //     catch (const boost::bad_lexical_cast&) {
+  //       return onFailure("invalid port number '" + faceUri->getPort() + "'");
+  //     }
+  //   }
 
-    FaceUri canonicalUri(typename Protocol::endpoint(ipAddress, port));
-    BOOST_ASSERT(canonicalUri.isCanonical());
-    onSuccess(canonicalUri);
-  }
+  //   FaceUri canonicalUri(typename Protocol::endpoint(ipAddress, port));
+  //   BOOST_ASSERT(canonicalUri.isCanonical());
+  //   onSuccess(canonicalUri);
+  // }
 
-  void
-  onDnsFailure(const shared_ptr<FaceUri>& faceUri,
-               const FaceUri::CanonizeFailureCallback& onFailure,
-               const std::string& reason) const
-  {
-    onFailure(reason);
-  }
+  // void
+  // onDnsFailure(const shared_ptr<FaceUri>& faceUri,
+  //              const FaceUri::CanonizeFailureCallback& onFailure,
+  //              const std::string& reason) const
+  // {
+  //   onFailure(reason);
+  // }
 
   /** \brief when overriden in a subclass, check the IP address is allowable
    *  \return (true,ignored) if the address is allowable;
    *          (false,reason) if the address is not allowable.
    */
-  virtual std::pair<bool, std::string>
-  checkAddress(const dns::IpAddress& ipAddress) const
-  {
-    return {true, ""};
-  }
+  // virtual std::pair<bool, std::string>
+  // checkAddress(const dns::IpAddress& ipAddress) const
+  // {
+  //   return {true, ""};
+  // }
 
   static std::string
   unescapeHost(std::string host)
@@ -451,14 +453,14 @@
   }
 
 protected:
-  std::pair<bool, std::string>
-  checkAddress(const dns::IpAddress& ipAddress) const override
-  {
-    if (ipAddress.is_multicast()) {
-      return {false, "cannot use multicast address"};
-    }
-    return {true, ""};
-  }
+  // std::pair<bool, std::string>
+  // checkAddress(const dns::IpAddress& ipAddress) const override
+  // {
+  //   if (ipAddress.is_multicast()) {
+  //     return {false, "cannot use multicast address"};
+  //   }
+  //   return {true, ""};
+  // }
 };
 
 class EtherCanonizeProvider : public CanonizeProvider
@@ -488,7 +490,7 @@
   canonize(const FaceUri& faceUri,
            const FaceUri::CanonizeSuccessCallback& onSuccess,
            const FaceUri::CanonizeFailureCallback& onFailure,
-           boost::asio::io_service& io, time::nanoseconds timeout) const override
+           time::nanoseconds timeout) const override
   {
     auto addr = ethernet::Address::fromString(faceUri.getHost());
     if (addr.isNull()) {
@@ -520,7 +522,7 @@
   canonize(const FaceUri& faceUri,
            const FaceUri::CanonizeSuccessCallback& onSuccess,
            const FaceUri::CanonizeFailureCallback& onFailure,
-           boost::asio::io_service& io, time::nanoseconds timeout) const override
+           time::nanoseconds timeout) const override
   {
     if (faceUri.getHost().empty()) {
       onFailure("network interface name is missing");
@@ -566,7 +568,7 @@
   canonize(const FaceUri& faceUri,
            const FaceUri::CanonizeSuccessCallback& onSuccess,
            const FaceUri::CanonizeFailureCallback& onFailure,
-           boost::asio::io_service& io, time::nanoseconds timeout) const override
+           time::nanoseconds timeout) const override
   {
     if (this->isCanonical(faceUri)) {
       onSuccess(faceUri);
@@ -645,7 +647,7 @@
 void
 FaceUri::canonize(const CanonizeSuccessCallback& onSuccess,
                   const CanonizeFailureCallback& onFailure,
-                  boost::asio::io_service& io, time::nanoseconds timeout) const
+                  time::nanoseconds timeout) const
 {
   const CanonizeProvider* cp = getCanonizeProvider(this->getScheme());
   if (cp == nullptr) {
@@ -660,7 +662,7 @@
   cp->canonize(*this,
                onSuccess ? onSuccess : successNop,
                onFailure ? onFailure : failureNop,
-               io, timeout);
+               timeout);
 }
 
 } // namespace ndn
diff --git a/src/net/face-uri.hpp b/src/net/face-uri.hpp
index 7461576..5f40e30 100644
--- a/src/net/face-uri.hpp
+++ b/src/net/face-uri.hpp
@@ -168,7 +168,6 @@
    *  \param onSuccess function to call after this FaceUri is converted to canonical form
    *  \note A new FaceUri in canonical form will be created; this FaceUri is unchanged.
    *  \param onFailure function to call if this FaceUri cannot be converted to canonical form
-   *  \param io        reference to `boost::asio::io_service` instance
    *  \param timeout   maximum allowable duration of the operations.
    *                   It's intentional not to provide a default value: the caller should set
    *                   a reasonable value in balance between network delay and user experience.
@@ -176,7 +175,6 @@
   void
   canonize(const CanonizeSuccessCallback& onSuccess,
            const CanonizeFailureCallback& onFailure,
-           boost::asio::io_service& io,
            time::nanoseconds timeout) const;
 
 private:
diff --git a/src/transport/stream-transport-impl.hpp b/src/transport/stream-transport-impl.hpp
deleted file mode 100644
index c8f1527..0000000
--- a/src/transport/stream-transport-impl.hpp
+++ /dev/null
@@ -1,283 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2013-2017 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#ifndef NDN_TRANSPORT_STREAM_TRANSPORT_IMPL_HPP
-#define NDN_TRANSPORT_STREAM_TRANSPORT_IMPL_HPP
-
-#include "transport.hpp"
-
-#include <boost/asio/deadline_timer.hpp>
-#include <boost/asio/write.hpp>
-
-#include <list>
-
-namespace ndn {
-
-/** \brief implementation detail of a Boost.Asio-based stream-oriented transport
- *  \tparam BaseTransport a subclass of Transport
- *  \tparam Protocol a Boost.Asio stream-oriented protocol, including boost::asio::ip::tcp
- *                   and boost::asio::local::stream_protocol
- */
-template<typename BaseTransport, typename Protocol>
-class StreamTransportImpl : public enable_shared_from_this<StreamTransportImpl<BaseTransport, Protocol>>
-{
-public:
-  typedef StreamTransportImpl<BaseTransport, Protocol> Impl;
-  typedef std::list<Block> BlockSequence;
-  typedef std::list<BlockSequence> TransmissionQueue;
-
-  StreamTransportImpl(BaseTransport& transport, boost::asio::io_service& ioService)
-    : m_transport(transport)
-    , m_socket(ioService)
-    , m_inputBufferSize(0)
-    , m_isConnecting(false)
-    , m_connectTimer(ioService)
-  {
-  }
-
-  void
-  connect(const typename Protocol::endpoint& endpoint)
-  {
-    if (!m_isConnecting) {
-      m_isConnecting = true;
-
-      // Wait at most 4 seconds to connect
-      /// @todo Decide whether this number should be configurable
-      m_connectTimer.expires_from_now(boost::posix_time::seconds(4));
-      m_connectTimer.async_wait(bind(&Impl::connectTimeoutHandler, this->shared_from_this(), _1));
-
-      m_socket.open();
-      m_socket.async_connect(endpoint, bind(&Impl::connectHandler, this->shared_from_this(), _1));
-    }
-  }
-
-  void
-  close()
-  {
-    m_isConnecting = false;
-
-    boost::system::error_code error; // to silently ignore all errors
-    m_connectTimer.cancel(error);
-    m_socket.cancel(error);
-    m_socket.close(error);
-
-    m_transport.m_isConnected = false;
-    m_transport.m_isReceiving = false;
-    m_transmissionQueue.clear();
-  }
-
-  void
-  pause()
-  {
-    if (m_isConnecting)
-      return;
-
-    if (m_transport.m_isReceiving) {
-      m_transport.m_isReceiving = false;
-      m_socket.cancel();
-    }
-  }
-
-  void
-  resume()
-  {
-    if (m_isConnecting)
-      return;
-
-    if (!m_transport.m_isReceiving) {
-      m_transport.m_isReceiving = true;
-      m_inputBufferSize = 0;
-      asyncReceive();
-    }
-  }
-
-  void
-  send(const Block& wire)
-  {
-    BlockSequence sequence;
-    sequence.push_back(wire);
-    send(std::move(sequence));
-  }
-
-  void
-  send(const Block& header, const Block& payload)
-  {
-    BlockSequence sequence;
-    sequence.push_back(header);
-    sequence.push_back(payload);
-    send(std::move(sequence));
-  }
-
-protected:
-  void
-  connectHandler(const boost::system::error_code& error)
-  {
-    m_isConnecting = false;
-    m_connectTimer.cancel();
-
-    if (!error) {
-      m_transport.m_isConnected = true;
-
-      if (!m_transmissionQueue.empty()) {
-        resume();
-        asyncWrite();
-      }
-    }
-    else {
-      m_transport.m_isConnected = false;
-      m_transport.close();
-      BOOST_THROW_EXCEPTION(Transport::Error(error, "error while connecting to the forwarder"));
-    }
-  }
-
-  void
-  connectTimeoutHandler(const boost::system::error_code& error)
-  {
-    if (error) // e.g., cancelled timer
-      return;
-
-    m_transport.close();
-    BOOST_THROW_EXCEPTION(Transport::Error(error, "error while connecting to the forwarder"));
-  }
-
-  void
-  send(BlockSequence&& sequence)
-  {
-    m_transmissionQueue.emplace_back(sequence);
-
-    if (m_transport.m_isConnected && m_transmissionQueue.size() == 1) {
-      asyncWrite();
-    }
-
-    // if not connected or there is transmission in progress (m_transmissionQueue.size() > 1),
-    // next write will be scheduled either in connectHandler or in asyncWriteHandler
-  }
-
-  void
-  asyncWrite()
-  {
-    BOOST_ASSERT(!m_transmissionQueue.empty());
-    boost::asio::async_write(m_socket, m_transmissionQueue.front(),
-      bind(&Impl::handleAsyncWrite, this->shared_from_this(), _1, m_transmissionQueue.begin()));
-  }
-
-  void
-  handleAsyncWrite(const boost::system::error_code& error, TransmissionQueue::iterator queueItem)
-  {
-    if (error) {
-      if (error == boost::system::errc::operation_canceled) {
-        // async receive has been explicitly cancelled (e.g., socket close)
-        return;
-      }
-
-      m_transport.close();
-      BOOST_THROW_EXCEPTION(Transport::Error(error, "error while sending data to socket"));
-    }
-
-    if (!m_transport.m_isConnected) {
-      return; // queue has been already cleared
-    }
-
-    m_transmissionQueue.erase(queueItem);
-
-    if (!m_transmissionQueue.empty()) {
-      asyncWrite();
-    }
-  }
-
-  void
-  asyncReceive()
-  {
-    m_socket.async_receive(boost::asio::buffer(m_inputBuffer + m_inputBufferSize,
-                                               MAX_NDN_PACKET_SIZE - m_inputBufferSize), 0,
-                           bind(&Impl::handleAsyncReceive, this->shared_from_this(), _1, _2));
-  }
-
-  void
-  handleAsyncReceive(const boost::system::error_code& error, std::size_t nBytesRecvd)
-  {
-    if (error) {
-      if (error == boost::system::errc::operation_canceled) {
-        // async receive has been explicitly cancelled (e.g., socket close)
-        return;
-      }
-
-      m_transport.close();
-      BOOST_THROW_EXCEPTION(Transport::Error(error, "error while receiving data from socket"));
-    }
-
-    m_inputBufferSize += nBytesRecvd;
-    // do magic
-
-    std::size_t offset = 0;
-    bool hasProcessedSome = processAllReceived(m_inputBuffer, offset, m_inputBufferSize);
-    if (!hasProcessedSome && m_inputBufferSize == MAX_NDN_PACKET_SIZE && offset == 0) {
-      m_transport.close();
-      BOOST_THROW_EXCEPTION(Transport::Error(boost::system::error_code(),
-                                             "input buffer full, but a valid TLV cannot be "
-                                             "decoded"));
-    }
-
-    if (offset > 0) {
-      if (offset != m_inputBufferSize) {
-        std::copy(m_inputBuffer + offset, m_inputBuffer + m_inputBufferSize, m_inputBuffer);
-        m_inputBufferSize -= offset;
-      }
-      else {
-        m_inputBufferSize = 0;
-      }
-    }
-
-    asyncReceive();
-  }
-
-  bool
-  processAllReceived(uint8_t* buffer, size_t& offset, size_t nBytesAvailable)
-  {
-    while (offset < nBytesAvailable) {
-      bool isOk = false;
-      Block element;
-      std::tie(isOk, element) = Block::fromBuffer(buffer + offset, nBytesAvailable - offset);
-      if (!isOk)
-        return false;
-
-      m_transport.receive(element);
-      offset += element.size();
-    }
-    return true;
-  }
-
-protected:
-  BaseTransport& m_transport;
-
-  typename Protocol::socket m_socket;
-  uint8_t m_inputBuffer[MAX_NDN_PACKET_SIZE];
-  size_t m_inputBufferSize;
-
-  TransmissionQueue m_transmissionQueue;
-  bool m_isConnecting;
-
-  boost::asio::deadline_timer m_connectTimer;
-};
-
-} // namespace ndn
-
-#endif // NDN_TRANSPORT_STREAM_TRANSPORT_IMPL_HPP
diff --git a/src/transport/stream-transport-with-resolver-impl.hpp b/src/transport/stream-transport-with-resolver-impl.hpp
deleted file mode 100644
index b9150d8..0000000
--- a/src/transport/stream-transport-with-resolver-impl.hpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2013-2017 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#ifndef NDN_TRANSPORT_STREAM_TRANSPORT_WITH_RESOLVER_IMPL_HPP
-#define NDN_TRANSPORT_STREAM_TRANSPORT_WITH_RESOLVER_IMPL_HPP
-
-#include "stream-transport-impl.hpp"
-
-namespace ndn {
-
-/** \brief implementation detail of a Boost.Asio-based stream-oriented transport
- *         with resolver support
- */
-template<typename BaseTransport, typename Protocol>
-class StreamTransportWithResolverImpl : public StreamTransportImpl<BaseTransport, Protocol>
-{
-public:
-  using Impl = StreamTransportWithResolverImpl<BaseTransport,Protocol>;
-
-  StreamTransportWithResolverImpl(BaseTransport& transport, boost::asio::io_service& ioService)
-    : StreamTransportImpl<BaseTransport, Protocol>(transport, ioService)
-  {
-  }
-
-  void
-  connect(const typename Protocol::resolver::query& query)
-  {
-    if (this->m_isConnecting) {
-      return;
-    }
-
-    this->m_isConnecting = true;
-
-    // Wait at most 4 seconds to connect
-    /// @todo Decide whether this number should be configurable
-    this->m_connectTimer.expires_from_now(boost::posix_time::seconds(4));
-    this->m_connectTimer.async_wait(bind(&Impl::connectTimeoutHandler, this->shared_from_this(), _1));
-
-    auto resolver = make_shared<typename Protocol::resolver>(ref(this->m_socket.get_io_service()));
-    resolver->async_resolve(query, bind(&Impl::resolveHandler, this->shared_from_base(), _1, _2, resolver));
-  }
-
-protected:
-  void
-  resolveHandler(const boost::system::error_code& error,
-                 typename Protocol::resolver::iterator endpoint,
-                 const shared_ptr<typename Protocol::resolver>&)
-  {
-    if (error) {
-      if (error == boost::system::errc::operation_canceled)
-        return;
-
-      BOOST_THROW_EXCEPTION(Transport::Error(error, "Error during resolution of host or port"));
-    }
-
-    typename Protocol::resolver::iterator end;
-    if (endpoint == end) {
-      this->m_transport.close();
-      BOOST_THROW_EXCEPTION(Transport::Error(error, "Unable to resolve host or port"));
-    }
-
-    this->m_socket.async_connect(*endpoint, bind(&Impl::connectHandler, this->shared_from_this(), _1));
-  }
-
-private:
-  shared_ptr<Impl>
-  shared_from_base()
-  {
-    return static_pointer_cast<Impl>(this->shared_from_this());
-  }
-};
-
-
-} // namespace ndn
-
-#endif // NDN_TRANSPORT_STREAM_TRANSPORT_WITH_RESOLVER_IMPL_HPP
diff --git a/src/transport/tcp-transport.cpp b/src/transport/tcp-transport.cpp
deleted file mode 100644
index 8b99f3e..0000000
--- a/src/transport/tcp-transport.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2013-2017 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#include "tcp-transport.hpp"
-#include "stream-transport-with-resolver-impl.hpp"
-#include "net/face-uri.hpp"
-#include "util/logger.hpp"
-
-NDN_LOG_INIT(ndn.TcpTransport);
-// DEBUG level: connect, close, pause, resume.
-
-namespace ndn {
-
-TcpTransport::TcpTransport(const std::string& host, const std::string& port/* = "6363"*/)
-  : m_host(host)
-  , m_port(port)
-{
-}
-
-TcpTransport::~TcpTransport() = default;
-
-shared_ptr<TcpTransport>
-TcpTransport::create(const std::string& uri)
-{
-  const auto hostAndPort(getSocketHostAndPortFromUri(uri));
-  return make_shared<TcpTransport>(hostAndPort.first, hostAndPort.second);
-}
-
-std::pair<std::string, std::string>
-TcpTransport::getSocketHostAndPortFromUri(const std::string& uriString)
-{
-  std::string host = "localhost";
-  std::string port = "6363";
-
-  if (uriString.empty()) {
-    return {host, port};
-  }
-
-  try {
-    const FaceUri uri(uriString);
-
-    const std::string scheme = uri.getScheme();
-    if (scheme != "tcp" && scheme != "tcp4" && scheme != "tcp6") {
-      BOOST_THROW_EXCEPTION(Error("Cannot create TcpTransport from \"" + scheme + "\" URI"));
-    }
-
-    if (!uri.getHost().empty()) {
-      host = uri.getHost();
-    }
-
-    if (!uri.getPort().empty()) {
-      port = uri.getPort();
-    }
-  }
-  catch (const FaceUri::Error& error) {
-    BOOST_THROW_EXCEPTION(Error(error.what()));
-  }
-
-  return {host, port};
-}
-
-void
-TcpTransport::connect(boost::asio::io_service& ioService,
-                      const ReceiveCallback& receiveCallback)
-{
-  NDN_LOG_DEBUG("connect host=" << m_host << " port=" << m_port);
-
-  if (m_impl == nullptr) {
-    Transport::connect(ioService, receiveCallback);
-
-    m_impl = make_shared<Impl>(ref(*this), ref(ioService));
-  }
-
-  boost::asio::ip::tcp::resolver::query query(m_host, m_port);
-  m_impl->connect(query);
-}
-
-void
-TcpTransport::send(const Block& wire)
-{
-  BOOST_ASSERT(m_impl != nullptr);
-  m_impl->send(wire);
-}
-
-void
-TcpTransport::send(const Block& header, const Block& payload)
-{
-  BOOST_ASSERT(m_impl != nullptr);
-  m_impl->send(header, payload);
-}
-
-void
-TcpTransport::close()
-{
-  BOOST_ASSERT(m_impl != nullptr);
-  NDN_LOG_DEBUG("close");
-  m_impl->close();
-  m_impl.reset();
-}
-
-void
-TcpTransport::pause()
-{
-  if (m_impl != nullptr) {
-    NDN_LOG_DEBUG("pause");
-    m_impl->pause();
-  }
-}
-
-void
-TcpTransport::resume()
-{
-  BOOST_ASSERT(m_impl != nullptr);
-  NDN_LOG_DEBUG("resume");
-  m_impl->resume();
-}
-
-} // namespace ndn
diff --git a/src/transport/tcp-transport.hpp b/src/transport/tcp-transport.hpp
deleted file mode 100644
index 6e8977f..0000000
--- a/src/transport/tcp-transport.hpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2013-2017 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#ifndef NDN_TRANSPORT_TCP_TRANSPORT_HPP
-#define NDN_TRANSPORT_TCP_TRANSPORT_HPP
-
-#include "transport.hpp"
-#include "../util/config-file.hpp"
-
-#include <boost/asio/ip/tcp.hpp>
-
-namespace ndn {
-
-template<typename BaseTransport, typename Protocol>
-class StreamTransportImpl;
-
-template<typename BaseTransport, typename Protocol>
-class StreamTransportWithResolverImpl;
-
-/** \brief a transport using TCP socket
- */
-class TcpTransport : public Transport
-{
-public:
-  explicit
-  TcpTransport(const std::string& host, const std::string& port = "6363");
-
-  ~TcpTransport() override;
-
-  void
-  connect(boost::asio::io_service& ioService, const ReceiveCallback& receiveCallback) override;
-
-  void
-  close() override;
-
-  void
-  pause() override;
-
-  void
-  resume() override;
-
-  void
-  send(const Block& wire) override;
-
-  void
-  send(const Block& header, const Block& payload) override;
-
-  /** \brief Create transport with parameters defined in URI
-   *  \throw Transport::Error incorrect URI or unsupported protocol is specified
-   */
-  static shared_ptr<TcpTransport>
-  create(const std::string& uri);
-
-NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
-  static std::pair<std::string, std::string>
-  getSocketHostAndPortFromUri(const std::string& uri);
-
-private:
-  std::string m_host;
-  std::string m_port;
-
-  using Impl = StreamTransportWithResolverImpl<TcpTransport, boost::asio::ip::tcp>;
-  friend class StreamTransportImpl<TcpTransport, boost::asio::ip::tcp>;
-  friend Impl;
-  shared_ptr<Impl> m_impl;
-};
-
-} // namespace ndn
-
-#endif // NDN_TRANSPORT_TCP_TRANSPORT_HPP
diff --git a/src/transport/transport.cpp b/src/transport/transport.cpp
index 0ea5bee..7cca3a2 100644
--- a/src/transport/transport.cpp
+++ b/src/transport/transport.cpp
@@ -34,19 +34,16 @@
 }
 
 Transport::Transport()
-  : m_ioService(nullptr)
-  , m_isConnected(false)
+  : m_isConnected(false)
   , m_isReceiving(false)
 {
 }
 
 void
-Transport::connect(boost::asio::io_service& ioService,
-                   const ReceiveCallback& receiveCallback)
+Transport::connect(const ReceiveCallback& receiveCallback)
 {
   BOOST_ASSERT(receiveCallback != nullptr);
 
-  m_ioService = &ioService;
   m_receiveCallback = receiveCallback;
 }
 
diff --git a/src/transport/transport.hpp b/src/transport/transport.hpp
index b177fad..f5b76dd 100644
--- a/src/transport/transport.hpp
+++ b/src/transport/transport.hpp
@@ -53,12 +53,11 @@
   ~Transport() = default;
 
   /** \brief asynchronously open the connection
-   *  \param ioService io_service to create socket on
    *  \param receiveCallback callback function when a TLV block is received; must not be empty
    *  \throw boost::system::system_error connection cannot be established
    */
   virtual void
-  connect(boost::asio::io_service& ioService, const ReceiveCallback& receiveCallback);
+  connect(const ReceiveCallback& receiveCallback);
 
   /** \brief Close the connection.
    */
@@ -113,7 +112,6 @@
   receive(const Block& wire);
 
 protected:
-  boost::asio::io_service* m_ioService;
   bool m_isConnected;
   bool m_isReceiving;
   ReceiveCallback m_receiveCallback;
diff --git a/src/transport/unix-transport.cpp b/src/transport/unix-transport.cpp
deleted file mode 100644
index 34ccf83..0000000
--- a/src/transport/unix-transport.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2013-2017 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#include "unix-transport.hpp"
-#include "stream-transport-impl.hpp"
-
-#include "../face.hpp"
-#include "net/face-uri.hpp"
-#include "util/logger.hpp"
-
-NDN_LOG_INIT(ndn.UnixTransport);
-// DEBUG level: connect, close, pause, resume.
-
-namespace ndn {
-
-UnixTransport::UnixTransport(const std::string& unixSocket)
-  : m_unixSocket(unixSocket)
-{
-}
-
-UnixTransport::~UnixTransport() = default;
-
-std::string
-UnixTransport::getSocketNameFromUri(const std::string& uriString)
-{
-  // Assume the default nfd.sock location.
-  std::string path = "/var/run/nfd.sock";
-
-  if (uriString.empty()) {
-    return path;
-  }
-
-  try {
-    const FaceUri uri(uriString);
-
-    if (uri.getScheme() != "unix") {
-      BOOST_THROW_EXCEPTION(Error("Cannot create UnixTransport from \"" +
-                                  uri.getScheme() + "\" URI"));
-    }
-
-    if (!uri.getPath().empty()) {
-      path = uri.getPath();
-    }
-  }
-  catch (const FaceUri::Error& error) {
-    BOOST_THROW_EXCEPTION(Error(error.what()));
-  }
-
-  return path;
-}
-
-shared_ptr<UnixTransport>
-UnixTransport::create(const std::string& uri)
-{
-  return make_shared<UnixTransport>(getSocketNameFromUri(uri));
-}
-
-void
-UnixTransport::connect(boost::asio::io_service& ioService,
-                       const ReceiveCallback& receiveCallback)
-{
-  NDN_LOG_DEBUG("connect path=" << m_unixSocket);
-
-  if (m_impl == nullptr) {
-    Transport::connect(ioService, receiveCallback);
-
-    m_impl = make_shared<Impl>(ref(*this), ref(ioService));
-  }
-
-  m_impl->connect(boost::asio::local::stream_protocol::endpoint(m_unixSocket));
-}
-
-void
-UnixTransport::send(const Block& wire)
-{
-  BOOST_ASSERT(m_impl != nullptr);
-  m_impl->send(wire);
-}
-
-void
-UnixTransport::send(const Block& header, const Block& payload)
-{
-  BOOST_ASSERT(m_impl != nullptr);
-  m_impl->send(header, payload);
-}
-
-void
-UnixTransport::close()
-{
-  BOOST_ASSERT(m_impl != nullptr);
-  NDN_LOG_DEBUG("close");
-  m_impl->close();
-  m_impl.reset();
-}
-
-void
-UnixTransport::pause()
-{
-  if (m_impl != nullptr) {
-    NDN_LOG_DEBUG("pause");
-    m_impl->pause();
-  }
-}
-
-void
-UnixTransport::resume()
-{
-  BOOST_ASSERT(m_impl != nullptr);
-  NDN_LOG_DEBUG("resume");
-  m_impl->resume();
-}
-
-} // namespace ndn
diff --git a/src/transport/unix-transport.hpp b/src/transport/unix-transport.hpp
deleted file mode 100644
index d337252..0000000
--- a/src/transport/unix-transport.hpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2013-2017 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#ifndef NDN_TRANSPORT_UNIX_TRANSPORT_HPP
-#define NDN_TRANSPORT_UNIX_TRANSPORT_HPP
-
-#include "transport.hpp"
-#include "../util/config-file.hpp"
-
-#include <boost/asio/local/stream_protocol.hpp>
-
-namespace ndn {
-
-template<typename BaseTransport, typename Protocol>
-class StreamTransportImpl;
-
-/** \brief a transport using Unix stream socket
- */
-class UnixTransport : public Transport
-{
-public:
-  explicit
-  UnixTransport(const std::string& unixSocket);
-
-  ~UnixTransport() override;
-
-  void
-  connect(boost::asio::io_service& ioService,
-          const ReceiveCallback& receiveCallback) override;
-
-  void
-  close() override;
-
-  void
-  pause() override;
-
-  void
-  resume() override;
-
-  void
-  send(const Block& wire) override;
-
-  void
-  send(const Block& header, const Block& payload) override;
-
-  /** \brief Create transport with parameters defined in URI
-   *  \throw Transport::Error incorrect URI or unsupported protocol is specified
-   */
-  static shared_ptr<UnixTransport>
-  create(const std::string& uri);
-
-NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
-  static std::string
-  getSocketNameFromUri(const std::string& uri);
-
-private:
-  std::string m_unixSocket;
-
-  using Impl = StreamTransportImpl<UnixTransport, boost::asio::local::stream_protocol>;
-  friend Impl;
-  shared_ptr<Impl> m_impl;
-};
-
-} // namespace ndn
-
-#endif // NDN_TRANSPORT_UNIX_TRANSPORT_HPP
diff --git a/src/util/scheduler.cpp b/src/util/scheduler.cpp
index 513348f..431375a 100644
--- a/src/util/scheduler.cpp
+++ b/src/util/scheduler.cpp
@@ -46,7 +46,7 @@
 namespace util {
 namespace scheduler {
 
-Scheduler::Scheduler(boost::asio::io_service& ioService)
+Scheduler::Scheduler(DummyIoService& ioService)
   : m_scheduledEvent(m_events.end())
 {
 }
diff --git a/src/util/scheduler.hpp b/src/util/scheduler.hpp
index 2d669b1..6f74e9a 100644
--- a/src/util/scheduler.hpp
+++ b/src/util/scheduler.hpp
@@ -62,7 +62,7 @@
   typedef EventCallback Event;
 
   explicit
-  Scheduler(boost::asio::io_service& ioService);
+  Scheduler(DummyIoService& ioService);
 
   ~Scheduler();
 
