diff --git a/daemon/face/channel.cpp b/daemon/face/channel.cpp
index d161504..65e0a25 100644
--- a/daemon/face/channel.cpp
+++ b/daemon/face/channel.cpp
@@ -1,11 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014  Regents of the University of California,
- *                     Arizona Board of Regents,
- *                     Colorado State University,
- *                     University Pierre & Marie Curie, Sorbonne University,
- *                     Washington University in St. Louis,
- *                     Beijing Institute of Technology
+ * Copyright (c) 2014-2015,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * You should have received a copy of the GNU General Public License along with
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
 
 #include "channel.hpp"
 
@@ -36,4 +37,17 @@
   m_uri = uri;
 }
 
+void
+connectFaceClosedSignal(Face& face, const std::function<void()>& f)
+{
+  using face::FaceState;
+
+  face.afterStateChange.connect(
+    [f] (FaceState oldState, FaceState newState) {
+      if (newState == FaceState::CLOSED) {
+        f();
+      }
+    });
+}
+
 } // namespace nfd
diff --git a/daemon/face/channel.hpp b/daemon/face/channel.hpp
index cb5ed27..640395a 100644
--- a/daemon/face/channel.hpp
+++ b/daemon/face/channel.hpp
@@ -26,12 +26,10 @@
 #ifndef NFD_DAEMON_FACE_CHANNEL_HPP
 #define NFD_DAEMON_FACE_CHANNEL_HPP
 
-#include "common.hpp"
+#include "face.hpp"
 
 namespace nfd {
 
-class Face;
-
 /**
  * \brief Prototype for the callback that is invoked when the face
  *        is created (as a response to incoming connection or after
@@ -69,6 +67,16 @@
   return m_uri;
 }
 
+/** \brief invokes a callback when the face is closed
+ *  \param face the face
+ *  \param f the callback to be invoked when the face enters CLOSED state
+ *
+ *  This function connects a callback to the afterStateChange signal on the \p face,
+ *  and invokes \p f when the state becomes CLOSED.
+ */
+void
+connectFaceClosedSignal(Face& face, const std::function<void()>& f);
+
 } // namespace nfd
 
 #endif // NFD_DAEMON_FACE_CHANNEL_HPP
diff --git a/daemon/face/ethernet-factory.cpp b/daemon/face/ethernet-factory.cpp
index 3592530..dd9d034 100644
--- a/daemon/face/ethernet-factory.cpp
+++ b/daemon/face/ethernet-factory.cpp
@@ -26,12 +26,10 @@
 #include "ethernet-factory.hpp"
 #include "ethernet-transport.hpp"
 #include "generic-link-service.hpp"
-#include "lp-face-wrapper.hpp"
-#include "core/global-io.hpp"
 
 namespace nfd {
 
-shared_ptr<face::LpFaceWrapper>
+shared_ptr<Face>
 EthernetFactory::createMulticastFace(const NetworkInterfaceInfo& interface,
                                      const ethernet::Address& address)
 {
@@ -48,14 +46,11 @@
 
   auto linkService = make_unique<face::GenericLinkService>(opts);
   auto transport = make_unique<face::EthernetTransport>(interface, address);
-  auto lpFace = make_unique<face::LpFace>(std::move(linkService), std::move(transport));
-  face = make_shared<face::LpFaceWrapper>(std::move(lpFace));
+  face = make_shared<Face>(std::move(linkService), std::move(transport));
 
   auto key = std::make_pair(interface.name, address);
-  face->onFail.connectSingleShot([this, key] (const std::string& reason) {
-    m_multicastFaces.erase(key);
-  });
   m_multicastFaces[key] = face;
+  connectFaceClosedSignal(*face, [this, key] { m_multicastFaces.erase(key); });
 
   return face;
 }
@@ -75,7 +70,7 @@
   return {};
 }
 
-shared_ptr<face::LpFaceWrapper>
+shared_ptr<Face>
 EthernetFactory::findMulticastFace(const std::string& interfaceName,
                                    const ethernet::Address& address) const
 {
diff --git a/daemon/face/ethernet-factory.hpp b/daemon/face/ethernet-factory.hpp
index c0a951d..add176e 100644
--- a/daemon/face/ethernet-factory.hpp
+++ b/daemon/face/ethernet-factory.hpp
@@ -31,10 +31,6 @@
 
 namespace nfd {
 
-namespace face {
-class LpFaceWrapper;
-} // namespace face
-
 class EthernetFactory : public ProtocolFactory
 {
 public:
@@ -52,7 +48,7 @@
   };
 
   typedef std::map<std::pair<std::string, ethernet::Address>,
-                   shared_ptr<face::LpFaceWrapper>> MulticastFaceMap;
+                   shared_ptr<Face>> MulticastFaceMap;
 
   /**
    * \brief Create an EthernetFace to communicate with the given multicast group
@@ -69,7 +65,7 @@
    *
    * \throws EthernetFactory::Error or EthernetTransport::Error
    */
-  shared_ptr<face::LpFaceWrapper>
+  shared_ptr<Face>
   createMulticastFace(const NetworkInterfaceInfo& interface,
                       const ethernet::Address& address);
 
@@ -96,7 +92,7 @@
    * \returns shared pointer to the existing EthernetFace object
    *          or nullptr when such face does not exist
    */
-  shared_ptr<face::LpFaceWrapper>
+  shared_ptr<Face>
   findMulticastFace(const std::string& interfaceName,
                     const ethernet::Address& address) const;
 
diff --git a/daemon/face/face-counters.cpp b/daemon/face/face-counters.cpp
index 611b151..7c4dee4 100644
--- a/daemon/face/face-counters.cpp
+++ b/daemon/face/face-counters.cpp
@@ -24,7 +24,6 @@
  */
 
 #include "face-counters.hpp"
-#include "old-face-counters.hpp"
 
 namespace nfd {
 namespace face {
@@ -46,24 +45,5 @@
 {
 }
 
-static const LinkService::Counters g_dummyLinkServiceCounters{};
-static const Transport::Counters g_dummyTransportCounters{};
-
-FaceCounters::FaceCounters(const OldFaceCounters& oldCounters)
-  : nInInterests(oldCounters.getNInInterests())
-  , nOutInterests(oldCounters.getNOutInterests())
-  , nInData(oldCounters.getNInDatas())
-  , nOutData(oldCounters.getNOutDatas())
-  , nInNacks(g_dummyLinkServiceCounters.nInNacks)
-  , nOutNacks(g_dummyLinkServiceCounters.nOutNacks)
-  , nInPackets(g_dummyTransportCounters.nInPackets)
-  , nOutPackets(g_dummyTransportCounters.nOutPackets)
-  , nInBytes(oldCounters.getNInBytes())
-  , nOutBytes(oldCounters.getNOutBytes())
-  , m_linkServiceCounters(g_dummyLinkServiceCounters)
-  , m_transportCounters(g_dummyTransportCounters)
-{
-}
-
 } // namespace face
 } // namespace nfd
diff --git a/daemon/face/face-counters.hpp b/daemon/face/face-counters.hpp
index 93aebf4..08facf8 100644
--- a/daemon/face/face-counters.hpp
+++ b/daemon/face/face-counters.hpp
@@ -30,9 +30,6 @@
 #include "transport.hpp"
 
 namespace nfd {
-
-class OldFaceCounters;
-
 namespace face {
 
 /** \brief gives access to counters provided by Face
@@ -48,14 +45,6 @@
   FaceCounters(const LinkService::Counters& linkServiceCounters,
                const Transport::Counters& transportCounters);
 
-  /** \brief wraps old counters
-   *
-   *  FaceCounters instance created from this constructor only provides Interest/Data counters
-   *  and Nack counters. Other counters are always zero. get<T>() should not be used.
-   */
-  explicit
-  FaceCounters(const OldFaceCounters& oldCounters);
-
   /** \return counters provided by LinkService
    *  \tparam T LinkService counters type
    *  \throw std::bad_cast counters type mismatch
diff --git a/daemon/face/face.cpp b/daemon/face/face.cpp
index 5367d39..69d32c1 100644
--- a/daemon/face/face.cpp
+++ b/daemon/face/face.cpp
@@ -25,73 +25,31 @@
 
 #include "face.hpp"
 
-#include <ndn-cxx/management/nfd-face-event-notification.hpp>
-
 namespace nfd {
+namespace face {
 
-Face::Face(const FaceUri& remoteUri, const FaceUri& localUri, bool isLocal, bool isMultiAccess)
-  : m_id(INVALID_FACEID)
-  , m_countersWrapper(m_counters)
-  , m_remoteUri(remoteUri)
-  , m_localUri(localUri)
-  , m_isLocal(isLocal)
-  , m_persistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
-  , m_isMultiAccess(isMultiAccess)
-  , m_isFailed(false)
+Face::Face(unique_ptr<LinkService> service, unique_ptr<Transport> transport)
+  : afterReceiveInterest(service->afterReceiveInterest)
+  , afterReceiveData(service->afterReceiveData)
+  , afterReceiveNack(service->afterReceiveNack)
+  , afterStateChange(transport->afterStateChange)
+  , m_id(INVALID_FACEID)
+  , m_service(std::move(service))
+  , m_transport(std::move(transport))
+  , m_counters(m_service->getCounters(), m_transport->getCounters())
 {
-  onReceiveInterest.connect([this] (const ndn::Interest&) { ++m_counters.getNInInterests(); });
-  onReceiveData    .connect([this] (const ndn::Data&)     { ++m_counters.getNInDatas(); });
-  onSendInterest   .connect([this] (const ndn::Interest&) { ++m_counters.getNOutInterests(); });
-  onSendData       .connect([this] (const ndn::Data&)     { ++m_counters.getNOutDatas(); });
+  m_service->setFaceAndTransport(*this, *m_transport);
+  m_transport->setFaceAndLinkService(*this, *m_service);
 }
 
-Face::~Face()
+std::ostream&
+operator<<(std::ostream& os, const FaceLogHelper<Face>& flh)
 {
+  const Face& face = flh.obj;
+  os << "[id=" << face.getId() << ",local=" << face.getLocalUri() <<
+        ",remote=" << face.getRemoteUri() << "] ";
+  return os;
 }
 
-bool
-Face::isUp() const
-{
-  return true;
-}
-
-bool
-Face::decodeAndDispatchInput(const Block& element)
-{
-  try {
-    /// \todo Ensure lazy field decoding process
-
-    if (element.type() == tlv::Interest)
-      {
-        shared_ptr<Interest> i = make_shared<Interest>();
-        i->wireDecode(element);
-        this->onReceiveInterest(*i);
-      }
-    else if (element.type() == tlv::Data)
-      {
-        shared_ptr<Data> d = make_shared<Data>();
-        d->wireDecode(element);
-        this->onReceiveData(*d);
-      }
-    else
-      return false;
-
-    return true;
-  }
-  catch (const tlv::Error&) {
-    return false;
-  }
-}
-
-void
-Face::fail(const std::string& reason)
-{
-  if (m_isFailed) {
-    return;
-  }
-
-  m_isFailed = true;
-  this->onFail(reason);
-}
-
+} // namespace face
 } // namespace nfd
diff --git a/daemon/face/face.hpp b/daemon/face/face.hpp
index d964ef1..d783dd0 100644
--- a/daemon/face/face.hpp
+++ b/daemon/face/face.hpp
@@ -23,27 +23,23 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef NFD_DAEMON_FACE_FACE_HPP
-#define NFD_DAEMON_FACE_FACE_HPP
+#ifndef NFD_DAEMON_FACE_HPP
+#define NFD_DAEMON_FACE_HPP
 
-#include "common.hpp"
-#include "core/logger.hpp"
+#include "transport.hpp"
+#include "link-service.hpp"
 #include "face-counters.hpp"
-#include "old-face-counters.hpp"
 #include "face-log.hpp"
 
-#include <ndn-cxx/management/nfd-face-status.hpp>
-
 namespace nfd {
+namespace face {
 
-/** \class FaceId
- *  \brief identifies a face
+/** \brief identifies a face
  */
-typedef int FaceId;
+typedef uint64_t FaceId;
 
 /// indicates an invalid FaceId
-const FaceId INVALID_FACEID = -1;
-
+const FaceId INVALID_FACEID = 0;
 /// identifies the InternalFace used in management
 const FaceId FACEID_INTERNAL_FACE = 1;
 /// identifies a packet comes from the ContentStore
@@ -53,169 +49,169 @@
 /// upper bound of reserved FaceIds
 const FaceId FACEID_RESERVED_MAX = 255;
 
-
-/** \brief represents a face
+/** \brief indicates the state of a face
  */
-class Face : noncopyable, public enable_shared_from_this<Face>
+typedef TransportState FaceState;
+
+/** \brief generalization of a network interface
+ *
+ *  A face generalizes a network interface.
+ *  It provides best-effort network-layer packet delivery services
+ *  on a physical interface, an overlay tunnel, or a link to a local application.
+ *
+ *  A face combines two parts: LinkService and Transport.
+ *  Transport is the lower part, which provides best-effort TLV block deliveries.
+ *  LinkService is the upper part, which translates between network-layer packets
+ *  and TLV blocks, and may provide additional services such as fragmentation and reassembly.
+ */
+class Face
+#ifndef WITH_TESTS
+DECL_CLASS_FINAL
+#endif
+  : public enable_shared_from_this<Face>, noncopyable
 {
 public:
-  /**
-   * \brief Face-related error
+  Face(unique_ptr<LinkService> service, unique_ptr<Transport> transport);
+
+  LinkService*
+  getLinkService();
+
+  Transport*
+  getTransport();
+
+public: // upper interface connected to forwarding
+  /** \brief sends Interest on Face
    */
-  class Error : public std::runtime_error
-  {
-  public:
-    explicit
-    Error(const std::string& what)
-      : std::runtime_error(what)
-    {
-    }
-  };
+  void
+  sendInterest(const Interest& interest);
 
-  Face(const FaceUri& remoteUri, const FaceUri& localUri,
-       bool isLocal = false, bool isMultiAccess = false);
-
-  virtual
-  ~Face();
-
-  /// fires when an Interest is received
-  signal::Signal<Face, Interest> onReceiveInterest;
-
-  /// fires when a Data is received
-  signal::Signal<Face, Data> onReceiveData;
-
-  /// fires when a Nack is received
-  signal::Signal<Face, lp::Nack> onReceiveNack;
-
-  /// fires when an Interest is sent out
-  signal::Signal<Face, Interest> onSendInterest;
-
-  /// fires when a Data is sent out
-  signal::Signal<Face, Data> onSendData;
-
-  /// fires when a Nack is sent out
-  signal::Signal<Face, lp::Nack> onSendNack;
-
-  /// fires when face disconnects or fails to perform properly
-  signal::Signal<Face, std::string/*reason*/> onFail;
-
-  /// send an Interest
-  virtual void
-  sendInterest(const Interest& interest) = 0;
-
-  /// send a Data
-  virtual void
-  sendData(const Data& data) = 0;
-
-  /// send a Nack
-  virtual void
-  sendNack(const ndn::lp::Nack& nack)
-  {
-  }
-
-  /** \brief Close the face
-   *
-   *  This terminates all communication on the face and cause
-   *  onFail() method event to be invoked
+  /** \brief sends Data on Face
    */
-  virtual void
-  close() = 0;
+  void
+  sendData(const Data& data);
 
-public: // attributes
+  /** \brief sends Nack on Face
+   */
+  void
+  sendNack(const lp::Nack& nack);
+
+  /** \brief signals on Interest received
+   */
+  signal::Signal<LinkService, Interest>& afterReceiveInterest;
+
+  /** \brief signals on Data received
+   */
+  signal::Signal<LinkService, Data>& afterReceiveData;
+
+  /** \brief signals on Nack received
+   */
+  signal::Signal<LinkService, lp::Nack>& afterReceiveNack;
+
+public: // static properties
+  /** \return face ID
+   */
   FaceId
   getId() const;
 
-  /** \brief Get the description
-   */
-  const std::string&
-  getDescription() const;
-
-  /** \brief Set the face description
-   *
-   *  This is typically invoked by management on set description command
+  /** \brief sets face ID
+   *  \note Normally, this should only be invoked by FaceTable.
    */
   void
-  setDescription(const std::string& description);
+  setId(FaceId id);
 
-  /** \brief Get whether face is connected to a local app
+  /** \return a FaceUri representing local endpoint
    */
-  bool
-  isLocal() const;
+  FaceUri
+  getLocalUri() const;
 
-  /** \brief Get the persistency setting
+  /** \return a FaceUri representing remote endpoint
+   */
+  FaceUri
+  getRemoteUri() const;
+
+  /** \return whether face is local or non-local for scope control purpose
+   */
+  ndn::nfd::FaceScope
+  getScope() const;
+
+  /** \return face persistency setting
    */
   ndn::nfd::FacePersistency
   getPersistency() const;
 
-  // 'virtual' to allow override in LpFaceWrapper
-  virtual void
-  setPersistency(ndn::nfd::FacePersistency persistency);
-
-  /** \brief Get whether packets sent by this face may reach multiple peers
-   */
-  bool
-  isMultiAccess() const;
-
-  /** \brief Get whether underlying communication is up
-   *
-   *  In this base class this property is always true.
-   */
-  virtual bool
-  isUp() const;
-
-  virtual const face::FaceCounters&
-  getCounters() const;
-
-  /** \return a FaceUri that represents the remote endpoint
-   */
-  const FaceUri&
-  getRemoteUri() const;
-
-  /** \return a FaceUri that represents the local endpoint (NFD side)
-   */
-  const FaceUri&
-  getLocalUri() const;
-
-protected:
-  bool
-  decodeAndDispatchInput(const Block& element);
-
-  /** \brief fail the face and raise onFail event if it's UP; otherwise do nothing
+  /** \brief changes face persistency setting
    */
   void
-  fail(const std::string& reason);
+  setPersistency(ndn::nfd::FacePersistency persistency);
 
-  OldFaceCounters&
-  getMutableCounters();
+  /** \return whether face is point-to-point or multi-access
+   */
+  ndn::nfd::LinkType
+  getLinkType() const;
 
-  DECLARE_SIGNAL_EMIT(onReceiveInterest)
-  DECLARE_SIGNAL_EMIT(onReceiveData)
-  DECLARE_SIGNAL_EMIT(onReceiveNack)
-  DECLARE_SIGNAL_EMIT(onSendInterest)
-  DECLARE_SIGNAL_EMIT(onSendData)
-  DECLARE_SIGNAL_EMIT(onSendNack)
+public: // dynamic properties
+  /** \return face state
+   */
+  FaceState
+  getState() const;
 
-  // this method should be used only by the FaceTable
-  // 'virtual' to allow override in LpFaceWrapper
-  virtual void
-  setId(FaceId faceId);
+  /** \brief signals after face state changed
+   */
+  signal::Signal<Transport, FaceState/*old*/, FaceState/*new*/>& afterStateChange;
+
+  /** \brief request the face to be closed
+   *
+   *  This operation is effective only if face is in UP or DOWN state,
+   *  otherwise it has no effect.
+   *  The face changes state to CLOSING, and performs cleanup procedure.
+   *  The state will be changed to CLOSED when cleanup is complete, which may
+   *  happen synchronously or asynchronously.
+   *
+   *  \warning the face must not be deallocated until its state changes to CLOSED
+   */
+  void
+  close();
+
+  const FaceCounters&
+  getCounters() const;
 
 private:
   FaceId m_id;
-  std::string m_description;
-  OldFaceCounters m_counters;
-  face::FaceCounters m_countersWrapper;
-  const FaceUri m_remoteUri;
-  const FaceUri m_localUri;
-  const bool m_isLocal;
-  ndn::nfd::FacePersistency m_persistency;
-  const bool m_isMultiAccess;
-  bool m_isFailed;
-
-  // allow setting FaceId
-  friend class FaceTable;
+  unique_ptr<LinkService> m_service;
+  unique_ptr<Transport> m_transport;
+  FaceCounters m_counters;
 };
 
+inline LinkService*
+Face::getLinkService()
+{
+  return m_service.get();
+}
+
+inline Transport*
+Face::getTransport()
+{
+  return m_transport.get();
+}
+
+inline void
+Face::sendInterest(const Interest& interest)
+{
+  m_service->sendInterest(interest);
+}
+
+inline void
+Face::sendData(const Data& data)
+{
+  m_service->sendData(data);
+}
+
+inline void
+Face::sendNack(const lp::Nack& nack)
+{
+  m_service->sendNack(nack);
+}
+
 inline FaceId
 Face::getId() const
 {
@@ -223,81 +219,80 @@
 }
 
 inline void
-Face::setId(FaceId faceId)
+Face::setId(FaceId id)
 {
-  m_id = faceId;
+  m_id = id;
 }
 
-inline const std::string&
-Face::getDescription() const
+inline FaceUri
+Face::getLocalUri() const
 {
-  return m_description;
+  return m_transport->getLocalUri();
 }
 
-inline void
-Face::setDescription(const std::string& description)
+inline FaceUri
+Face::getRemoteUri() const
 {
-  m_description = description;
+  return m_transport->getRemoteUri();
 }
 
-inline bool
-Face::isLocal() const
+inline ndn::nfd::FaceScope
+Face::getScope() const
 {
-  return m_isLocal;
+  return m_transport->getScope();
 }
 
 inline ndn::nfd::FacePersistency
 Face::getPersistency() const
 {
-  return m_persistency;
+  return m_transport->getPersistency();
 }
 
 inline void
 Face::setPersistency(ndn::nfd::FacePersistency persistency)
 {
-  m_persistency = persistency;
+  return m_transport->setPersistency(persistency);
 }
 
-inline bool
-Face::isMultiAccess() const
+inline ndn::nfd::LinkType
+Face::getLinkType() const
 {
-  return m_isMultiAccess;
+  return m_transport->getLinkType();
 }
 
-inline const face::FaceCounters&
+inline FaceState
+Face::getState() const
+{
+  return m_transport->getState();
+}
+
+inline void
+Face::close()
+{
+  m_transport->close();
+}
+
+inline const FaceCounters&
 Face::getCounters() const
 {
-  return m_countersWrapper;
-}
-
-inline OldFaceCounters&
-Face::getMutableCounters()
-{
   return m_counters;
 }
 
-inline const FaceUri&
-Face::getRemoteUri() const
-{
-  return m_remoteUri;
-}
-
-inline const FaceUri&
-Face::getLocalUri() const
-{
-  return m_localUri;
-}
+std::ostream&
+operator<<(std::ostream& os, const FaceLogHelper<Face>& flh);
 
 template<typename T>
 typename std::enable_if<std::is_base_of<Face, T>::value, std::ostream&>::type
-operator<<(std::ostream& os, const face::FaceLogHelper<T>& flh)
+operator<<(std::ostream& os, const FaceLogHelper<T>& flh)
 {
-  const Face& face = flh.obj;
-  os << "[id=" << face.getId() << ",local=" << face.getLocalUri() <<
-        ",remote=" << face.getRemoteUri() << "] ";
-  return os;
+  return os << FaceLogHelper<Face>(flh.obj);
 }
 
+} // namespace face
+
+using face::FaceId;
+using face::Face;
+
 } // namespace nfd
 
-#endif // NFD_DAEMON_FACE_FACE_HPP
+#endif // NFD_DAEMON_FACE_HPP
diff --git a/daemon/face/internal-face.cpp b/daemon/face/internal-face.cpp
index c89f87f..8bea03d 100644
--- a/daemon/face/internal-face.cpp
+++ b/daemon/face/internal-face.cpp
@@ -26,7 +26,6 @@
 #include "internal-face.hpp"
 #include "generic-link-service.hpp"
 #include "internal-transport.hpp"
-#include "lp-face-wrapper.hpp"
 #include "core/global-io.hpp"
 
 namespace nfd {
@@ -38,19 +37,16 @@
   GenericLinkService::Options serviceOpts;
   serviceOpts.allowLocalFields = true;
 
-  auto face = make_unique<LpFace>(make_unique<GenericLinkService>(serviceOpts),
-                                  make_unique<InternalForwarderTransport>());
-  auto faceW = make_shared<LpFaceWrapper>(std::move(face));
-  // TODO#3172 eliminate wrapper
+  auto face = make_shared<Face>(make_unique<GenericLinkService>(serviceOpts),
+                                make_unique<InternalForwarderTransport>());
 
-  InternalForwarderTransport* forwarderTransport =
-    static_cast<InternalForwarderTransport*>(faceW->getLpFace()->getTransport());
+  auto forwarderTransport = static_cast<InternalForwarderTransport*>(face->getTransport());
   auto clientTransport = make_shared<InternalClientTransport>();
   clientTransport->connectToForwarder(forwarderTransport);
 
   auto clientFace = make_shared<ndn::Face>(clientTransport, getGlobalIoService(), clientKeyChain);
 
-  return std::make_tuple(faceW, clientFace);
+  return std::make_tuple(face, clientFace);
 }
 
 } // namespace face
diff --git a/daemon/face/link-service.cpp b/daemon/face/link-service.cpp
index 93507e0..00dd6f0 100644
--- a/daemon/face/link-service.cpp
+++ b/daemon/face/link-service.cpp
@@ -24,8 +24,7 @@
  */
 
 #include "link-service.hpp"
-#include "lp-face.hpp"
-#include "transport.hpp"
+#include "face.hpp"
 
 namespace nfd {
 namespace face {
@@ -43,7 +42,7 @@
 }
 
 void
-LinkService::setFaceAndTransport(LpFace& face, Transport& transport)
+LinkService::setFaceAndTransport(Face& face, Transport& transport)
 {
   BOOST_ASSERT(m_face == nullptr);
   BOOST_ASSERT(m_transport == nullptr);
@@ -118,7 +117,7 @@
 std::ostream&
 operator<<(std::ostream& os, const FaceLogHelper<LinkService>& flh)
 {
-  const LpFace* face = flh.obj.getFace();
+  const Face* face = flh.obj.getFace();
   if (face == nullptr) {
     os << "[id=0,local=unknown,remote=unknown] ";
   }
diff --git a/daemon/face/link-service.hpp b/daemon/face/link-service.hpp
index 031735a..618e863 100644
--- a/daemon/face/link-service.hpp
+++ b/daemon/face/link-service.hpp
@@ -33,7 +33,7 @@
 namespace nfd {
 namespace face {
 
-class LpFace;
+class Face;
 
 /** \brief counters provided by LinkService
  *  \note The type name 'LinkServiceCounters' is implementation detail.
@@ -67,8 +67,8 @@
   PacketCounter nOutNacks;
 };
 
-/** \brief the upper part of an LpFace
- *  \sa LpFace
+/** \brief the upper part of a Face
+ *  \sa Face
  */
 class LinkService : protected virtual LinkServiceCounters, noncopyable
 {
@@ -87,11 +87,11 @@
    *  \pre setFaceAndTransport has not been called
    */
   void
-  setFaceAndTransport(LpFace& face, Transport& transport);
+  setFaceAndTransport(Face& face, Transport& transport);
 
   /** \return Face to which this LinkService is attached
    */
-  const LpFace*
+  const Face*
   getFace() const;
 
   /** \return Transport to which this LinkService is attached
@@ -187,11 +187,11 @@
   doReceivePacket(Transport::Packet&& packet) = 0;
 
 private:
-  LpFace* m_face;
+  Face* m_face;
   Transport* m_transport;
 };
 
-inline const LpFace*
+inline const Face*
 LinkService::getFace() const
 {
   return m_face;
diff --git a/daemon/face/lp-face-wrapper.cpp b/daemon/face/lp-face-wrapper.cpp
deleted file mode 100644
index 920997a..0000000
--- a/daemon/face/lp-face-wrapper.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  Regents of the University of California,
- *                           Arizona Board of Regents,
- *                           Colorado State University,
- *                           University Pierre & Marie Curie, Sorbonne University,
- *                           Washington University in St. Louis,
- *                           Beijing Institute of Technology,
- *                           The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "lp-face-wrapper.hpp"
-
-namespace nfd {
-namespace face {
-
-LpFaceWrapper::LpFaceWrapper(unique_ptr<LpFace> face)
-  : Face(face->getRemoteUri(), face->getLocalUri(),
-         face->getScope() == ndn::nfd::FACE_SCOPE_LOCAL,
-         face->getLinkType() == ndn::nfd::LINK_TYPE_MULTI_ACCESS)
-  , m_face(std::move(face))
-{
-  this->Face::setPersistency(m_face->getPersistency());
-  m_face->afterReceiveInterest.connect(bind(&LpFaceWrapper::dispatchInterest, this, _1));
-  m_face->afterReceiveData.connect(bind(&LpFaceWrapper::dispatchData, this, _1));
-  m_face->afterReceiveNack.connect(bind(&LpFaceWrapper::dispatchNack, this, _1));
-  m_face->afterStateChange.connect(bind(&LpFaceWrapper::handleStateChange, this, _1, _2));
-}
-
-void
-LpFaceWrapper::setPersistency(ndn::nfd::FacePersistency persistency)
-{
-  this->Face::setPersistency(persistency);
-  m_face->setPersistency(persistency);
-}
-
-void
-LpFaceWrapper::setId(nfd::FaceId faceId)
-{
-  this->Face::setId(faceId);
-
-  FaceId lpId = static_cast<FaceId>(faceId);
-  if (faceId == nfd::INVALID_FACEID) {
-    lpId = INVALID_FACEID;
-  }
-  m_face->setId(lpId);
-}
-
-void
-LpFaceWrapper::dispatchInterest(const Interest& interest)
-{
-  this->emitSignal(onReceiveInterest, interest);
-}
-
-void
-LpFaceWrapper::dispatchData(const Data& data)
-{
-  this->emitSignal(onReceiveData, data);
-}
-
-void
-LpFaceWrapper::dispatchNack(const ndn::lp::Nack& nack)
-{
-  this->emitSignal(onReceiveNack, nack);
-}
-
-void
-LpFaceWrapper::handleStateChange(FaceState oldState, FaceState newState)
-{
-  if (newState != FaceState::CLOSED) {
-    return;
-  }
-
-  switch (oldState) {
-  case FaceState::CLOSING:
-    this->fail("LpFace closed");
-    break;
-  case FaceState::FAILED:
-    this->fail("LpFace failed");
-    break;
-  default:
-    BOOST_ASSERT(false);
-    break;
-  }
-}
-
-} // namespace face
-} // namespace nfd
diff --git a/daemon/face/lp-face-wrapper.hpp b/daemon/face/lp-face-wrapper.hpp
deleted file mode 100644
index 4cfb0f3..0000000
--- a/daemon/face/lp-face-wrapper.hpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  Regents of the University of California,
- *                           Arizona Board of Regents,
- *                           Colorado State University,
- *                           University Pierre & Marie Curie, Sorbonne University,
- *                           Washington University in St. Louis,
- *                           Beijing Institute of Technology,
- *                           The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NFD_DAEMON_FACE_LP_FACE_WRAPPER_HPP
-#define NFD_DAEMON_FACE_LP_FACE_WRAPPER_HPP
-
-#include "common.hpp"
-#include "face.hpp"
-#include "lp-face.hpp"
-
-namespace nfd {
-namespace face {
-
-/** \brief an adaptor to provide old Face APIs from an LpFace
- *  \sa LpFace
- */
-class LpFaceWrapper : public Face
-{
-public:
-  explicit
-  LpFaceWrapper(unique_ptr<LpFace> face);
-
-  LpFace*
-  getLpFace();
-
-  virtual void
-  sendInterest(const Interest& interest) DECL_OVERRIDE;
-
-  virtual void
-  sendData(const Data& data) DECL_OVERRIDE;
-
-  virtual void
-  sendNack(const lp::Nack& nack) DECL_OVERRIDE;
-
-  virtual void
-  close() DECL_OVERRIDE;
-
-  virtual bool
-  isUp() const DECL_OVERRIDE;
-
-  virtual void
-  setPersistency(ndn::nfd::FacePersistency persistency) DECL_OVERRIDE;
-
-  virtual const FaceCounters&
-  getCounters() const DECL_OVERRIDE;
-
-protected:
-  virtual void
-  setId(nfd::FaceId faceId) DECL_OVERRIDE;
-
-private:
-  void
-  dispatchInterest(const Interest& interest);
-
-  void
-  dispatchData(const Data& data);
-
-  void
-  dispatchNack(const lp::Nack& nack);
-
-  void
-  handleStateChange(FaceState oldState, FaceState newState);
-
-private:
-  unique_ptr<LpFace> m_face;
-};
-
-inline LpFace*
-LpFaceWrapper::getLpFace()
-{
-  return m_face.get();
-}
-
-inline void
-LpFaceWrapper::sendInterest(const Interest& interest)
-{
-  this->emitSignal(onSendInterest, interest);
-  m_face->sendInterest(interest);
-}
-
-inline void
-LpFaceWrapper::sendData(const Data& data)
-{
-  this->emitSignal(onSendData, data);
-  m_face->sendData(data);
-}
-
-inline void
-LpFaceWrapper::sendNack(const lp::Nack& nack)
-{
-  this->emitSignal(onSendNack, nack);
-  m_face->sendNack(nack);
-}
-
-inline void
-LpFaceWrapper::close()
-{
-  m_face->close();
-}
-
-inline bool
-LpFaceWrapper::isUp() const
-{
-  return m_face->getState() == FaceState::UP;
-}
-
-inline const FaceCounters&
-LpFaceWrapper::getCounters() const
-{
-  return m_face->getCounters();
-}
-
-} // namespace face
-} // namespace nfd
-
-#endif // NFD_DAEMON_FACE_LP_FACE_WRAPPER_HPP
diff --git a/daemon/face/lp-face.hpp b/daemon/face/lp-face.hpp
deleted file mode 100644
index 130fe00..0000000
--- a/daemon/face/lp-face.hpp
+++ /dev/null
@@ -1,303 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  Regents of the University of California,
- *                           Arizona Board of Regents,
- *                           Colorado State University,
- *                           University Pierre & Marie Curie, Sorbonne University,
- *                           Washington University in St. Louis,
- *                           Beijing Institute of Technology,
- *                           The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NFD_DAEMON_LP_FACE_HPP
-#define NFD_DAEMON_LP_FACE_HPP
-
-#include "transport.hpp"
-#include "link-service.hpp"
-#include "face-counters.hpp"
-#include "face-log.hpp"
-
-namespace nfd {
-namespace face {
-
-/** \brief identifies a face
- */
-typedef uint64_t FaceId;
-
-/// indicates an invalid FaceId
-const FaceId INVALID_FACEID = 0;
-/// identifies the InternalFace used in management
-const FaceId FACEID_INTERNAL_FACE = 1;
-/// identifies a packet comes from the ContentStore
-const FaceId FACEID_CONTENT_STORE = 254;
-/// identifies the NullFace that drops every packet
-const FaceId FACEID_NULL = 255;
-/// upper bound of reserved FaceIds
-const FaceId FACEID_RESERVED_MAX = 255;
-
-/** \brief indicates the state of a face
- */
-typedef TransportState FaceState;
-
-/** \brief generalization of a network interface
- *
- *  A face generalizes a network interface.
- *  It provides network-layer packet delivery services on a physical interface,
- *  an overlay tunnel, or a link to a local application, with best-effort.
- *
- *  A face combines two parts: LinkService and Transport.
- *  Transport is the lower part, which provides TLV block delivery services with best-effort.
- *  LinkService is the upper part, which translates between network-layer packets
- *  and TLV blocks, and may provide additional services such as fragmentation and reassembly.
- *
- *  We are in the process of refactoring face system to use this LinkService+Transport
- *  architecture. During this process, the "face" is named LpFace, and we implement a
- *  LpFaceWrapper class as an adaptor to the old Face APIs. After the completion of refactoring,
- *  LpFace will be renamed to Face.
- */
-class LpFace
-#ifndef WITH_TESTS
-DECL_CLASS_FINAL
-#endif
-  : noncopyable
-{
-public:
-  LpFace(unique_ptr<LinkService> service, unique_ptr<Transport> transport);
-
-  LinkService*
-  getLinkService();
-
-  Transport*
-  getTransport();
-
-public: // upper interface connected to forwarding
-  /** \brief sends Interest on Face
-   */
-  void
-  sendInterest(const Interest& interest);
-
-  /** \brief sends Data on Face
-   */
-  void
-  sendData(const Data& data);
-
-  /** \brief sends Nack on Face
-   */
-  void
-  sendNack(const lp::Nack& nack);
-
-  /** \brief signals on Interest received
-   */
-  signal::Signal<LinkService, Interest>& afterReceiveInterest;
-
-  /** \brief signals on Data received
-   */
-  signal::Signal<LinkService, Data>& afterReceiveData;
-
-  /** \brief signals on Nack received
-   */
-  signal::Signal<LinkService, lp::Nack>& afterReceiveNack;
-
-public: // static properties
-  /** \return face ID
-   */
-  FaceId
-  getId() const;
-
-  /** \brief sets face ID
-   *  \note Normally, this should only be invoked by FaceTable.
-   */
-  void
-  setId(FaceId id);
-
-  /** \return a FaceUri representing local endpoint
-   */
-  FaceUri
-  getLocalUri() const;
-
-  /** \return a FaceUri representing remote endpoint
-   */
-  FaceUri
-  getRemoteUri() const;
-
-  /** \return whether face is local or non-local for scope control purpose
-   */
-  ndn::nfd::FaceScope
-  getScope() const;
-
-  /** \return face persistency setting
-   */
-  ndn::nfd::FacePersistency
-  getPersistency() const;
-
-  /** \brief changes face persistency setting
-   */
-  void
-  setPersistency(ndn::nfd::FacePersistency persistency);
-
-  /** \return whether face is point-to-point or multi-access
-   */
-  ndn::nfd::LinkType
-  getLinkType() const;
-
-public: // dynamic properties
-  /** \return face state
-   */
-  FaceState
-  getState() const;
-
-  /** \brief signals after face state changed
-   */
-  signal::Signal<Transport, FaceState/*old*/, FaceState/*new*/>& afterStateChange;
-
-  /** \brief request the face to be closed
-   *
-   *  This operation is effective only if face is in UP or DOWN state,
-   *  otherwise it has no effect.
-   *  The face changes state to CLOSING, and performs cleanup procedure.
-   *  The state will be changed to CLOSED when cleanup is complete, which may
-   *  happen synchronously or asynchronously.
-   *
-   *  \warning the face must not be deallocated until its state changes to CLOSED
-   */
-  void
-  close();
-
-  const FaceCounters&
-  getCounters() const;
-
-private:
-  FaceId m_id;
-  unique_ptr<LinkService> m_service;
-  unique_ptr<Transport> m_transport;
-  FaceCounters m_counters;
-};
-
-inline LinkService*
-LpFace::getLinkService()
-{
-  return m_service.get();
-}
-
-inline Transport*
-LpFace::getTransport()
-{
-  return m_transport.get();
-}
-
-inline void
-LpFace::sendInterest(const Interest& interest)
-{
-  m_service->sendInterest(interest);
-}
-
-inline void
-LpFace::sendData(const Data& data)
-{
-  m_service->sendData(data);
-}
-
-inline void
-LpFace::sendNack(const lp::Nack& nack)
-{
-  m_service->sendNack(nack);
-}
-
-inline FaceId
-LpFace::getId() const
-{
-  return m_id;
-}
-
-inline void
-LpFace::setId(FaceId id)
-{
-  m_id = id;
-}
-
-inline FaceUri
-LpFace::getLocalUri() const
-{
-  return m_transport->getLocalUri();
-}
-
-inline FaceUri
-LpFace::getRemoteUri() const
-{
-  return m_transport->getRemoteUri();
-}
-
-inline ndn::nfd::FaceScope
-LpFace::getScope() const
-{
-  return m_transport->getScope();
-}
-
-inline ndn::nfd::FacePersistency
-LpFace::getPersistency() const
-{
-  return m_transport->getPersistency();
-}
-
-inline void
-LpFace::setPersistency(ndn::nfd::FacePersistency persistency)
-{
-  return m_transport->setPersistency(persistency);
-}
-
-inline ndn::nfd::LinkType
-LpFace::getLinkType() const
-{
-  return m_transport->getLinkType();
-}
-
-inline FaceState
-LpFace::getState() const
-{
-  return m_transport->getState();
-}
-
-inline void
-LpFace::close()
-{
-  m_transport->close();
-}
-
-inline const FaceCounters&
-LpFace::getCounters() const
-{
-  return m_counters;
-}
-
-template<typename T>
-typename std::enable_if<std::is_base_of<LpFace, T>::value, std::ostream&>::type
-operator<<(std::ostream& os, const FaceLogHelper<T>& flh)
-{
-  const LpFace& face = flh.obj;
-  os << "[id=" << face.getId() << ",local=" << face.getLocalUri() <<
-        ",remote=" << face.getRemoteUri() << "] ";
-  return os;
-}
-
-} // namespace face
-
-// using face::FaceId; // TODO uncomment in #3172
-using face::LpFace;
-
-} // namespace nfd
-
-#endif // NFD_DAEMON_LP_FACE_HPP
diff --git a/daemon/face/null-face.cpp b/daemon/face/null-face.cpp
index 2c409a7..a793e3e 100644
--- a/daemon/face/null-face.cpp
+++ b/daemon/face/null-face.cpp
@@ -24,7 +24,6 @@
  */
 
 #include "null-face.hpp"
-#include "lp-face-wrapper.hpp"
 #include "generic-link-service.hpp"
 #include "internal-transport.hpp"
 
@@ -37,12 +36,8 @@
 shared_ptr<Face>
 makeNullFace(const FaceUri& uri)
 {
-  auto face = make_unique<LpFace>(make_unique<GenericLinkService>(),
-                                  make_unique<InternalForwarderTransport>(uri, uri, ndn::nfd::FACE_SCOPE_LOCAL));
-  auto faceW = make_shared<LpFaceWrapper>(std::move(face));
-  // TODO#3172 eliminate wrapper
-
-  return faceW;
+  return make_shared<Face>(make_unique<GenericLinkService>(),
+                           make_unique<InternalForwarderTransport>(uri, uri, ndn::nfd::FACE_SCOPE_LOCAL));
 }
 
 } // namespace face
diff --git a/daemon/face/old-face-counters.hpp b/daemon/face/old-face-counters.hpp
deleted file mode 100644
index 1c1dd2e..0000000
--- a/daemon/face/old-face-counters.hpp
+++ /dev/null
@@ -1,178 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  Regents of the University of California,
- *                           Arizona Board of Regents,
- *                           Colorado State University,
- *                           University Pierre & Marie Curie, Sorbonne University,
- *                           Washington University in St. Louis,
- *                           Beijing Institute of Technology,
- *                           The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NFD_DAEMON_FACE_OLD_FACE_COUNTERS_HPP
-#define NFD_DAEMON_FACE_OLD_FACE_COUNTERS_HPP
-
-#include "core/counter.hpp"
-
-namespace nfd {
-
-/** \brief contains network layer packet counters
- */
-class NetworkLayerCounters : noncopyable
-{
-public:
-  /// incoming Interest
-  const PacketCounter&
-  getNInInterests() const
-  {
-    return m_nInInterests;
-  }
-
-  PacketCounter&
-  getNInInterests()
-  {
-    return m_nInInterests;
-  }
-
-  /// incoming Data
-  const PacketCounter&
-  getNInDatas() const
-  {
-    return m_nInDatas;
-  }
-
-  PacketCounter&
-  getNInDatas()
-  {
-    return m_nInDatas;
-  }
-
-  /// outgoing Interest
-  const PacketCounter&
-  getNOutInterests() const
-  {
-    return m_nOutInterests;
-  }
-
-  PacketCounter&
-  getNOutInterests()
-  {
-    return m_nOutInterests;
-  }
-
-  /// outgoing Data
-  const PacketCounter&
-  getNOutDatas() const
-  {
-    return m_nOutDatas;
-  }
-
-  PacketCounter&
-  getNOutDatas()
-  {
-    return m_nOutDatas;
-  }
-
-protected:
-  /** \brief copy current obseverations to a struct
-   *  \param recipient an object with set methods for counters
-   */
-  template<typename R>
-  void
-  copyTo(R& recipient) const
-  {
-    recipient.setNInInterests(this->getNInInterests());
-    recipient.setNInDatas(this->getNInDatas());
-    recipient.setNOutInterests(this->getNOutInterests());
-    recipient.setNOutDatas(this->getNOutDatas());
-  }
-
-private:
-  PacketCounter m_nInInterests;
-  PacketCounter m_nInDatas;
-  PacketCounter m_nOutInterests;
-  PacketCounter m_nOutDatas;
-};
-
-/** \brief contains link layer byte counters
- */
-class LinkLayerCounters : noncopyable
-{
-public:
-  /// received bytes
-  const ByteCounter&
-  getNInBytes() const
-  {
-    return m_nInBytes;
-  }
-
-  ByteCounter&
-  getNInBytes()
-  {
-    return m_nInBytes;
-  }
-
-  /// sent bytes
-  const ByteCounter&
-  getNOutBytes() const
-  {
-    return m_nOutBytes;
-  }
-
-  ByteCounter&
-  getNOutBytes()
-  {
-    return m_nOutBytes;
-  }
-
-protected:
-  /** \brief copy current obseverations to a struct
-   *  \param recipient an object with set methods for counters
-   */
-  template<typename R>
-  void
-  copyTo(R& recipient) const
-  {
-    recipient.setNInBytes(this->getNInBytes());
-    recipient.setNOutBytes(this->getNOutBytes());
-  }
-
-private:
-  ByteCounter m_nInBytes;
-  ByteCounter m_nOutBytes;
-};
-
-/** \brief contains counters on face (2014 face architecture)
- */
-class OldFaceCounters : public NetworkLayerCounters, public LinkLayerCounters
-{
-public:
-  /** \brief copy current obseverations to a struct
-   *  \param recipient an object with set methods for counters
-   */
-  template<typename R>
-  void
-  copyTo(R& recipient) const
-  {
-    this->NetworkLayerCounters::copyTo(recipient);
-    this->LinkLayerCounters::copyTo(recipient);
-  }
-};
-
-} // namespace nfd
-
-#endif // NFD_DAEMON_FACE_OLD_FACE_COUNTERS_HPP
diff --git a/daemon/face/tcp-channel.cpp b/daemon/face/tcp-channel.cpp
index f9873c2..21943c8 100644
--- a/daemon/face/tcp-channel.cpp
+++ b/daemon/face/tcp-channel.cpp
@@ -99,7 +99,7 @@
                        const FaceCreatedCallback& onFaceCreated,
                        bool isOnDemand)
 {
-  shared_ptr<face::LpFaceWrapper> face;
+  shared_ptr<Face> face;
   tcp::Endpoint remoteEndpoint = socket.remote_endpoint();
 
   auto it = m_channelFaces.find(remoteEndpoint);
@@ -108,14 +108,14 @@
                                   : ndn::nfd::FACE_PERSISTENCY_PERSISTENT;
     auto linkService = make_unique<face::GenericLinkService>();
     auto transport = make_unique<face::TcpTransport>(std::move(socket), persistency);
-    auto lpFace = make_unique<face::LpFace>(std::move(linkService), std::move(transport));
-    face = make_shared<face::LpFaceWrapper>(std::move(lpFace));
+    face = make_shared<Face>(std::move(linkService), std::move(transport));
 
-    face->onFail.connectSingleShot([this, remoteEndpoint] (const std::string&) {
-      NFD_LOG_TRACE("Erasing " << remoteEndpoint << " from channel face map");
-      m_channelFaces.erase(remoteEndpoint);
-    });
     m_channelFaces[remoteEndpoint] = face;
+    connectFaceClosedSignal(*face,
+      [this, remoteEndpoint] {
+        NFD_LOG_TRACE("Erasing " << remoteEndpoint << " from channel face map");
+        m_channelFaces.erase(remoteEndpoint);
+      });
   }
   else {
     // we already have a face for this endpoint, just reuse it
diff --git a/daemon/face/tcp-channel.hpp b/daemon/face/tcp-channel.hpp
index 799fbf1..c819014 100644
--- a/daemon/face/tcp-channel.hpp
+++ b/daemon/face/tcp-channel.hpp
@@ -27,7 +27,6 @@
 #define NFD_DAEMON_FACE_TCP_CHANNEL_HPP
 
 #include "channel.hpp"
-#include "lp-face-wrapper.hpp"
 #include "core/scheduler.hpp"
 
 namespace nfd {
@@ -114,7 +113,7 @@
                        const FaceCreationFailedCallback& onConnectFailed);
 
 private:
-  std::map<tcp::Endpoint, shared_ptr<face::LpFaceWrapper>> m_channelFaces;
+  std::map<tcp::Endpoint, shared_ptr<Face>> m_channelFaces;
 
   tcp::Endpoint m_localEndpoint;
   boost::asio::ip::tcp::acceptor m_acceptor;
diff --git a/daemon/face/transport.cpp b/daemon/face/transport.cpp
index e3e1e07..2d2c3dd 100644
--- a/daemon/face/transport.cpp
+++ b/daemon/face/transport.cpp
@@ -24,8 +24,7 @@
  */
 
 #include "transport.hpp"
-#include "lp-face.hpp"
-#include "link-service.hpp"
+#include "face.hpp"
 
 namespace nfd {
 namespace face {
@@ -73,7 +72,7 @@
 }
 
 void
-Transport::setFaceAndLinkService(LpFace& face, LinkService& service)
+Transport::setFaceAndLinkService(Face& face, LinkService& service)
 {
   BOOST_ASSERT(m_face == nullptr);
   BOOST_ASSERT(m_service == nullptr);
@@ -190,7 +189,7 @@
 operator<<(std::ostream& os, const FaceLogHelper<Transport>& flh)
 {
   const Transport& transport = flh.obj;
-  const LpFace* face = transport.getFace();
+  const Face* face = transport.getFace();
   FaceId faceId = face == nullptr ? INVALID_FACEID : face->getId();
 
   os << "[id=" << faceId << ",local=" << transport.getLocalUri()
diff --git a/daemon/face/transport.hpp b/daemon/face/transport.hpp
index 626809c..56ff730 100644
--- a/daemon/face/transport.hpp
+++ b/daemon/face/transport.hpp
@@ -33,7 +33,7 @@
 namespace nfd {
 namespace face {
 
-class LpFace;
+class Face;
 class LinkService;
 
 /** \brief indicates the state of a transport
@@ -98,8 +98,8 @@
  */
 const ssize_t MTU_INVALID = -2;
 
-/** \brief the lower part of an LpFace
- *  \sa LpFace
+/** \brief the lower part of a Face
+ *  \sa Face
  */
 class Transport : protected virtual TransportCounters, noncopyable
 {
@@ -154,11 +154,11 @@
    *  \pre setFaceAndLinkService has not been called
    */
   void
-  setFaceAndLinkService(LpFace& face, LinkService& service);
+  setFaceAndLinkService(Face& face, LinkService& service);
 
   /** \return Face to which this Transport is attached
    */
-  const LpFace*
+  const Face*
   getFace() const;
 
   /** \return LinkService to which this Transport is attached
@@ -307,7 +307,7 @@
   doSend(Packet&& packet) = 0;
 
 private:
-  LpFace* m_face;
+  Face* m_face;
   LinkService* m_service;
   FaceUri m_localUri;
   FaceUri m_remoteUri;
@@ -318,7 +318,7 @@
   TransportState m_state;
 };
 
-inline const LpFace*
+inline const Face*
 Transport::getFace() const
 {
   return m_face;
diff --git a/daemon/face/udp-channel.cpp b/daemon/face/udp-channel.cpp
index bb6529f..e6d65df 100644
--- a/daemon/face/udp-channel.cpp
+++ b/daemon/face/udp-channel.cpp
@@ -120,7 +120,7 @@
   NFD_LOG_DEBUG("[" << m_localEndpoint << "] New peer " << m_remoteEndpoint);
 
   bool isCreated = false;
-  shared_ptr<face::LpFaceWrapper> face;
+  shared_ptr<Face> face;
   try {
     std::tie(isCreated, face) = createFace(m_remoteEndpoint, ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
   }
@@ -136,12 +136,12 @@
     onFaceCreated(face);
 
   // dispatch the datagram to the face for processing
-  static_cast<face::UnicastUdpTransport*>(face->getLpFace()->getTransport())->receiveDatagram(m_inputBuffer, nBytesReceived, error);
+  static_cast<face::UnicastUdpTransport*>(face->getTransport())->receiveDatagram(m_inputBuffer, nBytesReceived, error);
 
   this->waitForNewPeer(onFaceCreated, onReceiveFailed);
 }
 
-std::pair<bool, shared_ptr<face::LpFaceWrapper>>
+std::pair<bool, shared_ptr<Face>>
 UdpChannel::createFace(const udp::Endpoint& remoteEndpoint, ndn::nfd::FacePersistency persistency)
 {
   auto it = m_channelFaces.find(remoteEndpoint);
@@ -166,13 +166,13 @@
 
   auto linkService = make_unique<face::GenericLinkService>();
   auto transport = make_unique<face::UnicastUdpTransport>(std::move(socket), persistency, m_idleFaceTimeout);
-  auto face = make_shared<face::LpFaceWrapper>(make_unique<face::LpFace>(
-                                               std::move(linkService), std::move(transport)));
+  auto face = make_shared<Face>(std::move(linkService), std::move(transport));
 
   face->setPersistency(persistency);
 
   m_channelFaces[remoteEndpoint] = face;
-  face->onFail.connectSingleShot([this, remoteEndpoint] (const std::string&) {
+  connectFaceClosedSignal(*face,
+    [this, remoteEndpoint] {
       NFD_LOG_TRACE("Erasing " << remoteEndpoint << " from channel face map");
       m_channelFaces.erase(remoteEndpoint);
     });
diff --git a/daemon/face/udp-channel.hpp b/daemon/face/udp-channel.hpp
index a24d1ec..a2506d4 100644
--- a/daemon/face/udp-channel.hpp
+++ b/daemon/face/udp-channel.hpp
@@ -27,7 +27,6 @@
 #define NFD_DAEMON_FACE_UDP_CHANNEL_HPP
 
 #include "channel.hpp"
-#include "lp-face-wrapper.hpp"
 
 namespace nfd {
 
@@ -105,11 +104,11 @@
                 const FaceCreatedCallback& onFaceCreated,
                 const FaceCreationFailedCallback& onReceiveFailed);
 
-  std::pair<bool, shared_ptr<face::LpFaceWrapper>>
+  std::pair<bool, shared_ptr<Face>>
   createFace(const udp::Endpoint& remoteEndpoint, ndn::nfd::FacePersistency persistency);
 
 private:
-  std::map<udp::Endpoint, shared_ptr<face::LpFaceWrapper>> m_channelFaces;
+  std::map<udp::Endpoint, shared_ptr<Face>> m_channelFaces;
 
   udp::Endpoint m_localEndpoint;
 
diff --git a/daemon/face/udp-factory.cpp b/daemon/face/udp-factory.cpp
index 2a39e36..cc60a63 100644
--- a/daemon/face/udp-factory.cpp
+++ b/daemon/face/udp-factory.cpp
@@ -25,7 +25,6 @@
 
 #include "udp-factory.hpp"
 #include "generic-link-service.hpp"
-#include "lp-face-wrapper.hpp"
 #include "multicast-udp-transport.hpp"
 #include "core/global-io.hpp"
 #include "core/network-interface.hpp"
@@ -127,7 +126,7 @@
   return createChannel(endpoint, timeout);
 }
 
-shared_ptr<face::LpFaceWrapper>
+shared_ptr<Face>
 UdpFactory::createMulticastFace(const udp::Endpoint& localEndpoint,
                                 const udp::Endpoint& multicastEndpoint,
                                 const std::string& networkInterfaceName/* = ""*/)
@@ -210,18 +209,15 @@
   auto transport = make_unique<face::MulticastUdpTransport>(localEndpoint, multicastEndpoint,
                                                             std::move(receiveSocket),
                                                             std::move(sendSocket));
-  auto lpFace = make_unique<face::LpFace>(std::move(linkService), std::move(transport));
-  face = make_shared<face::LpFaceWrapper>(std::move(lpFace));
+  face = make_shared<Face>(std::move(linkService), std::move(transport));
 
-  face->onFail.connectSingleShot([this, localEndpoint] (const std::string& reason) {
-    m_multicastFaces.erase(localEndpoint);
-  });
   m_multicastFaces[localEndpoint] = face;
+  connectFaceClosedSignal(*face, [this, localEndpoint] { m_multicastFaces.erase(localEndpoint); });
 
   return face;
 }
 
-shared_ptr<face::LpFaceWrapper>
+shared_ptr<Face>
 UdpFactory::createMulticastFace(const std::string& localIp,
                                 const std::string& multicastIp,
                                 const std::string& multicastPort,
@@ -294,7 +290,7 @@
     return nullptr;
 }
 
-shared_ptr<face::LpFaceWrapper>
+shared_ptr<Face>
 UdpFactory::findMulticastFace(const udp::Endpoint& localEndpoint) const
 {
   auto i = m_multicastFaces.find(localEndpoint);
diff --git a/daemon/face/udp-factory.hpp b/daemon/face/udp-factory.hpp
index 134c5ee..9c851bd 100644
--- a/daemon/face/udp-factory.hpp
+++ b/daemon/face/udp-factory.hpp
@@ -49,7 +49,7 @@
     }
   };
 
-  typedef std::map<udp::Endpoint, shared_ptr<face::LpFaceWrapper>> MulticastFaceMap;
+  typedef std::map<udp::Endpoint, shared_ptr<Face>> MulticastFaceMap;
 
   /**
    * \brief Create UDP-based channel using udp::Endpoint
@@ -128,12 +128,12 @@
    * \see http://www.boost.org/doc/libs/1_42_0/doc/html/boost_asio/reference/ip__udp/endpoint.html
    *      for details on ways to create udp::Endpoint
    */
-  shared_ptr<face::LpFaceWrapper>
+  shared_ptr<Face>
   createMulticastFace(const udp::Endpoint& localEndpoint,
                       const udp::Endpoint& multicastEndpoint,
                       const std::string& networkInterfaceName = "");
 
-  shared_ptr<face::LpFaceWrapper>
+  shared_ptr<Face>
   createMulticastFace(const std::string& localIp,
                       const std::string& multicastIp,
                       const std::string& multicastPort,
@@ -181,7 +181,7 @@
    * \returns shared pointer to the existing multicast UdpFace object
    *          or nullptr when such face does not exist
    */
-  shared_ptr<face::LpFaceWrapper>
+  shared_ptr<Face>
   findMulticastFace(const udp::Endpoint& localEndpoint) const;
 
 private:
diff --git a/daemon/face/unix-stream-channel.cpp b/daemon/face/unix-stream-channel.cpp
index c34ad7b..5b56c6a 100644
--- a/daemon/face/unix-stream-channel.cpp
+++ b/daemon/face/unix-stream-channel.cpp
@@ -25,7 +25,6 @@
 
 #include "unix-stream-channel.hpp"
 #include "generic-link-service.hpp"
-#include "lp-face-wrapper.hpp"
 #include "unix-stream-transport.hpp"
 #include "core/global-io.hpp"
 
@@ -135,8 +134,7 @@
 
   auto linkService = make_unique<face::GenericLinkService>();
   auto transport = make_unique<face::UnixStreamTransport>(std::move(m_socket));
-  auto lpFace = make_unique<face::LpFace>(std::move(linkService), std::move(transport));
-  auto face = make_shared<face::LpFaceWrapper>(std::move(lpFace));
+  auto face = make_shared<Face>(std::move(linkService), std::move(transport));
   onFaceCreated(face);
 
   // prepare accepting the next connection
diff --git a/daemon/face/websocket-channel.cpp b/daemon/face/websocket-channel.cpp
index 520bb7d..75626ab 100644
--- a/daemon/face/websocket-channel.cpp
+++ b/daemon/face/websocket-channel.cpp
@@ -77,7 +77,7 @@
 {
   auto it = m_channelFaces.find(hdl);
   if (it != m_channelFaces.end()) {
-    static_cast<face::WebSocketTransport*>(it->second->getLpFace()->getTransport())->handlePongTimeout();
+    static_cast<face::WebSocketTransport*>(it->second->getTransport())->handlePongTimeout();
   }
   else {
     NFD_LOG_WARN("Pong timeout on unknown transport");
@@ -89,7 +89,7 @@
 {
   auto it = m_channelFaces.find(hdl);
   if (it != m_channelFaces.end()) {
-    static_cast<face::WebSocketTransport*>(it->second->getLpFace()->getTransport())->handlePong();
+    static_cast<face::WebSocketTransport*>(it->second->getTransport())->handlePong();
   }
   else {
     NFD_LOG_WARN("Pong received on unknown transport");
@@ -102,7 +102,7 @@
 {
   auto it = m_channelFaces.find(hdl);
   if (it != m_channelFaces.end()) {
-    static_cast<face::WebSocketTransport*>(it->second->getLpFace()->getTransport())->receiveMessage(msg->get_payload());
+    static_cast<face::WebSocketTransport*>(it->second->getTransport())->receiveMessage(msg->get_payload());
   }
   else {
     NFD_LOG_WARN("Message received on unknown transport");
@@ -114,16 +114,10 @@
 {
   auto linkService = make_unique<face::GenericLinkService>();
   auto transport = make_unique<face::WebSocketTransport>(hdl, ref(m_server), m_pingInterval);
-  auto lpFace = make_unique<face::LpFace>(std::move(linkService), std::move(transport));
-  auto face = make_shared<face::LpFaceWrapper>(std::move(lpFace));
+  auto face = make_shared<Face>(std::move(linkService), std::move(transport));
 
-  face->getLpFace()->afterStateChange.connect(
-    [this, hdl] (face::FaceState oldState, face::FaceState newState) {
-      if (newState == face::FaceState::CLOSED) {
-        m_channelFaces.erase(hdl);
-      }
-    });
   m_channelFaces[hdl] = face;
+  connectFaceClosedSignal(*face, [this, hdl] { m_channelFaces.erase(hdl); });
 
   m_onFaceCreatedCallback(face);
 }
@@ -133,7 +127,7 @@
 {
   auto it = m_channelFaces.find(hdl);
   if (it != m_channelFaces.end()) {
-    it->second->getLpFace()->close();
+    it->second->close();
   }
   else {
     NFD_LOG_WARN("Close on unknown transport");
diff --git a/daemon/face/websocket-channel.hpp b/daemon/face/websocket-channel.hpp
index 47eda8c..1d56731 100644
--- a/daemon/face/websocket-channel.hpp
+++ b/daemon/face/websocket-channel.hpp
@@ -1,12 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014  Regents of the University of California,
- *                     Arizona Board of Regents,
- *                     Colorado State University,
- *                     University Pierre & Marie Curie, Sorbonne University,
- *                     Washington University in St. Louis,
- *                     Beijing Institute of Technology,
- *                     The University of Memphis
+ * Copyright (c) 2014-2015,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -21,13 +21,12 @@
  *
  * You should have received a copy of the GNU General Public License along with
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
 
 #ifndef NFD_DAEMON_FACE_WEBSOCKET_CHANNEL_HPP
 #define NFD_DAEMON_FACE_WEBSOCKET_CHANNEL_HPP
 
 #include "channel.hpp"
-#include "lp-face-wrapper.hpp"
 #include "websocketpp.hpp"
 
 namespace nfd {
@@ -102,7 +101,7 @@
   websocket::Endpoint m_localEndpoint;
   websocket::Server m_server;
 
-  std::map<websocketpp::connection_hdl, shared_ptr<face::LpFaceWrapper>,
+  std::map<websocketpp::connection_hdl, shared_ptr<Face>,
            std::owner_less<websocketpp::connection_hdl>> m_channelFaces;
 
   FaceCreatedCallback m_onFaceCreatedCallback;
diff --git a/daemon/fw/access-strategy.cpp b/daemon/fw/access-strategy.cpp
index 5489837..b1ed449 100644
--- a/daemon/fw/access-strategy.cpp
+++ b/daemon/fw/access-strategy.cpp
@@ -115,7 +115,7 @@
 AccessStrategy::sendToLastNexthop(const Face& inFace, shared_ptr<pit::Entry> pitEntry, MtInfo& mi,
                                   shared_ptr<fib::Entry> fibEntry)
 {
-  if (mi.lastNexthop == INVALID_FACEID) {
+  if (mi.lastNexthop == face::INVALID_FACEID) {
     NFD_LOG_DEBUG(pitEntry->getInterest() << " no-last-nexthop");
     return false;
   }
@@ -231,7 +231,7 @@
 }
 
 AccessStrategy::MtInfo::MtInfo()
-  : lastNexthop(INVALID_FACEID)
+  : lastNexthop(face::INVALID_FACEID)
   , rtt(1, time::milliseconds(1), 0.1)
 {
 }
diff --git a/daemon/fw/client-control-strategy.cpp b/daemon/fw/client-control-strategy.cpp
index 7cc07fd..1066efa 100644
--- a/daemon/fw/client-control-strategy.cpp
+++ b/daemon/fw/client-control-strategy.cpp
@@ -58,7 +58,7 @@
 
   FaceId outFaceId = static_cast<FaceId>(*tag);
   shared_ptr<Face> outFace = this->getFace(outFaceId);
-  if (!static_cast<bool>(outFace)) {
+  if (outFace == nullptr) {
     // If outFace doesn't exist, it's better to reject the Interest
     // than to use BestRouteStrategy.
     NFD_LOG_WARN("Interest " << interest.getName() <<
diff --git a/daemon/fw/face-table.cpp b/daemon/fw/face-table.cpp
index a8a8053..b4bda23 100644
--- a/daemon/fw/face-table.cpp
+++ b/daemon/fw/face-table.cpp
@@ -27,6 +27,7 @@
 #include "forwarder.hpp"
 #include "core/global-io.hpp"
 #include "core/logger.hpp"
+#include "face/channel.hpp"
 
 namespace nfd {
 
@@ -34,7 +35,7 @@
 
 FaceTable::FaceTable(Forwarder& forwarder)
   : m_forwarder(forwarder)
-  , m_lastFaceId(FACEID_RESERVED_MAX)
+  , m_lastFaceId(face::FACEID_RESERVED_MAX)
 {
 }
 
@@ -59,22 +60,22 @@
 void
 FaceTable::add(shared_ptr<Face> face)
 {
-  if (face->getId() != INVALID_FACEID && m_faces.count(face->getId()) > 0) {
+  if (face->getId() != face::INVALID_FACEID && m_faces.count(face->getId()) > 0) {
     NFD_LOG_WARN("Trying to add existing face id=" << face->getId() << " to the face table");
     return;
   }
 
   FaceId faceId = ++m_lastFaceId;
-  BOOST_ASSERT(faceId > FACEID_RESERVED_MAX);
+  BOOST_ASSERT(faceId > face::FACEID_RESERVED_MAX);
   this->addImpl(face, faceId);
 }
 
 void
 FaceTable::addReserved(shared_ptr<Face> face, FaceId faceId)
 {
-  BOOST_ASSERT(face->getId() == INVALID_FACEID);
+  BOOST_ASSERT(face->getId() == face::INVALID_FACEID);
   BOOST_ASSERT(m_faces.count(face->getId()) == 0);
-  BOOST_ASSERT(faceId <= FACEID_RESERVED_MAX);
+  BOOST_ASSERT(faceId <= face::FACEID_RESERVED_MAX);
   this->addImpl(face, faceId);
 }
 
@@ -86,30 +87,26 @@
   NFD_LOG_INFO("Added face id=" << faceId << " remote=" << face->getRemoteUri()
                                           << " local=" << face->getLocalUri());
 
-  face->onReceiveInterest.connect(bind(&Forwarder::startProcessInterest,
-                                       &m_forwarder, ref(*face), _1));
-  face->onReceiveData.connect(bind(&Forwarder::startProcessData,
-                                   &m_forwarder, ref(*face), _1));
-  face->onReceiveNack.connect(bind(&Forwarder::startProcessNack,
-                                   &m_forwarder, ref(*face), _1));
-  face->onFail.connectSingleShot(bind(&FaceTable::remove, this, face, _1));
+  face->afterReceiveInterest.connect(bind(&Forwarder::startProcessInterest, &m_forwarder, ref(*face), _1));
+  face->afterReceiveData.connect(bind(&Forwarder::startProcessData, &m_forwarder, ref(*face), _1));
+  face->afterReceiveNack.connect(bind(&Forwarder::startProcessNack, &m_forwarder, ref(*face), _1));
+  connectFaceClosedSignal(*face, bind(&FaceTable::remove, this, face));
 
-  this->onAdd(face);
+  this->afterAdd(face);
 }
 
 void
-FaceTable::remove(shared_ptr<Face> face, const std::string& reason)
+FaceTable::remove(shared_ptr<Face> face)
 {
-  this->onRemove(face);
+  this->beforeRemove(face);
 
   FaceId faceId = face->getId();
   m_faces.erase(faceId);
-  face->setId(INVALID_FACEID);
+  face->setId(face::INVALID_FACEID);
 
   NFD_LOG_INFO("Removed face id=" << faceId <<
                " remote=" << face->getRemoteUri() <<
-               " local=" << face->getLocalUri() <<
-               " (" << reason << ")");
+               " local=" << face->getLocalUri());
 
   m_forwarder.getFib().removeNextHopFromAllEntries(face);
 
diff --git a/daemon/fw/face-table.hpp b/daemon/fw/face-table.hpp
index 67c7932..a9186f6 100644
--- a/daemon/fw/face-table.hpp
+++ b/daemon/fw/face-table.hpp
@@ -1,12 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014,  Regents of the University of California,
- *                      Arizona Board of Regents,
- *                      Colorado State University,
- *                      University Pierre & Marie Curie, Sorbonne University,
- *                      Washington University in St. Louis,
- *                      Beijing Institute of Technology,
- *                      The University of Memphis
+ * Copyright (c) 2014-2015,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -75,22 +75,20 @@
 public: // signals
   /** \brief fires after a Face is added
    */
-  signal::Signal<FaceTable, shared_ptr<Face>> onAdd;
+  signal::Signal<FaceTable, shared_ptr<Face>> afterAdd;
 
   /** \brief fires before a Face is removed
    *
    *  FaceId is valid when this event is fired
    */
-  signal::Signal<FaceTable, shared_ptr<Face>> onRemove;
+  signal::Signal<FaceTable, shared_ptr<Face>> beforeRemove;
 
 private:
   void
   addImpl(shared_ptr<Face> face, FaceId faceId);
 
-  // remove is private because it's a handler of face.onFail signal.
-  // face->close() closes the face and triggers .remove()
   void
-  remove(shared_ptr<Face> face, const std::string& reason);
+  remove(shared_ptr<Face> face);
 
   ForwardRange
   getForwardRange() const;
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index e96b87b..280c713 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -108,7 +108,7 @@
   ++m_counters.nInInterests;
 
   // /localhost scope control
-  bool isViolatingLocalhost = !inFace.isLocal() &&
+  bool isViolatingLocalhost = inFace.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL &&
                               LOCALHOST_NAME.isPrefixOf(interest.getName());
   if (isViolatingLocalhost) {
     NFD_LOG_DEBUG("onIncomingInterest face=" << inFace.getId() <<
@@ -151,7 +151,7 @@
                           shared_ptr<pit::Entry> pitEntry)
 {
   // if multi-access face, drop
-  if (inFace.isMultiAccess()) {
+  if (inFace.getLinkType() == ndn::nfd::LINK_TYPE_MULTI_ACCESS) {
     NFD_LOG_DEBUG("onInterestLoop face=" << inFace.getId() <<
                   " interest=" << interest.getName() <<
                   " drop");
@@ -244,7 +244,7 @@
 {
   NFD_LOG_DEBUG("onContentStoreHit interest=" << interest.getName());
 
-  data.setTag(make_shared<lp::IncomingFaceIdTag>(FACEID_CONTENT_STORE));
+  data.setTag(make_shared<lp::IncomingFaceIdTag>(face::FACEID_CONTENT_STORE));
   // XXX should we lookup PIT for other Interests that also match csMatch?
 
   // set PIT straggler timer
@@ -284,7 +284,7 @@
 Forwarder::onOutgoingInterest(shared_ptr<pit::Entry> pitEntry, Face& outFace,
                               bool wantNewNonce)
 {
-  if (outFace.getId() == INVALID_FACEID) {
+  if (outFace.getId() == face::INVALID_FACEID) {
     NFD_LOG_WARN("onOutgoingInterest face=invalid interest=" << pitEntry->getName());
     return;
   }
@@ -374,7 +374,7 @@
   ++m_counters.nInData;
 
   // /localhost scope control
-  bool isViolatingLocalhost = !inFace.isLocal() &&
+  bool isViolatingLocalhost = inFace.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL &&
                               LOCALHOST_NAME.isPrefixOf(data.getName());
   if (isViolatingLocalhost) {
     NFD_LOG_DEBUG("onIncomingData face=" << inFace.getId() <<
@@ -439,7 +439,7 @@
 Forwarder::onDataUnsolicited(Face& inFace, const Data& data)
 {
   // accept to cache?
-  bool acceptToCache = inFace.isLocal();
+  bool acceptToCache = inFace.getScope() == ndn::nfd::FACE_SCOPE_LOCAL;
   if (acceptToCache) {
     // CS insert
     m_cs.insert(data, true);
@@ -453,14 +453,14 @@
 void
 Forwarder::onOutgoingData(const Data& data, Face& outFace)
 {
-  if (outFace.getId() == INVALID_FACEID) {
+  if (outFace.getId() == face::INVALID_FACEID) {
     NFD_LOG_WARN("onOutgoingData face=invalid data=" << data.getName());
     return;
   }
   NFD_LOG_DEBUG("onOutgoingData face=" << outFace.getId() << " data=" << data.getName());
 
   // /localhost scope control
-  bool isViolatingLocalhost = !outFace.isLocal() &&
+  bool isViolatingLocalhost = outFace.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL &&
                               LOCALHOST_NAME.isPrefixOf(data.getName());
   if (isViolatingLocalhost) {
     NFD_LOG_DEBUG("onOutgoingData face=" << outFace.getId() <<
@@ -484,7 +484,7 @@
   ++m_counters.nInNacks;
 
   // if multi-access face, drop
-  if (inFace.isMultiAccess()) {
+  if (inFace.getLinkType() == ndn::nfd::LINK_TYPE_MULTI_ACCESS) {
     NFD_LOG_DEBUG("onIncomingNack face=" << inFace.getId() <<
                   " nack=" << nack.getInterest().getName() <<
                   "~" << nack.getReason() << " face-is-multi-access");
@@ -537,7 +537,7 @@
 Forwarder::onOutgoingNack(shared_ptr<pit::Entry> pitEntry, const Face& outFace,
                           const lp::NackHeader& nack)
 {
-  if (outFace.getId() == INVALID_FACEID) {
+  if (outFace.getId() == face::INVALID_FACEID) {
     NFD_LOG_WARN("onOutgoingNack face=invalid" <<
                   " nack=" << pitEntry->getInterest().getName() <<
                   "~" << nack.getReason() << " no-in-record");
@@ -556,7 +556,7 @@
   }
 
   // if multi-access face, drop
-  if (outFace.isMultiAccess()) {
+  if (outFace.getLinkType() == ndn::nfd::LINK_TYPE_MULTI_ACCESS) {
     NFD_LOG_DEBUG("onOutgoingNack face=" << outFace.getId() <<
                   " nack=" << pitEntry->getInterest().getName() <<
                   "~" << nack.getReason() << " face-is-multi-access");
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index 7b0504e..00fe82f 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -33,8 +33,8 @@
 NFD_LOG_INIT("Strategy");
 
 Strategy::Strategy(Forwarder& forwarder, const Name& name)
-  : afterAddFace(forwarder.getFaceTable().onAdd)
-  , beforeRemoveFace(forwarder.getFaceTable().onRemove)
+  : afterAddFace(forwarder.getFaceTable().afterAdd)
+  , beforeRemoveFace(forwarder.getFaceTable().beforeRemove)
   , m_name(name)
   , m_forwarder(forwarder)
   , m_measurements(m_forwarder.getMeasurements(),
diff --git a/daemon/mgmt/face-manager.cpp b/daemon/mgmt/face-manager.cpp
index d773206..0cc40d5 100644
--- a/daemon/mgmt/face-manager.cpp
+++ b/daemon/mgmt/face-manager.cpp
@@ -27,7 +27,6 @@
 
 #include "core/network-interface.hpp"
 #include "face/generic-link-service.hpp"
-#include "face/lp-face-wrapper.hpp"
 #include "face/tcp-factory.hpp"
 #include "face/udp-factory.hpp"
 #include "fw/face-table.hpp"
@@ -77,9 +76,9 @@
 
   auto postNotification = registerNotificationStream("events");
   m_faceAddConn =
-    m_faceTable.onAdd.connect(bind(&FaceManager::afterFaceAdded, this, _1, postNotification));
+    m_faceTable.afterAdd.connect(bind(&FaceManager::afterFaceAdded, this, _1, postNotification));
   m_faceRemoveConn =
-    m_faceTable.onRemove.connect(bind(&FaceManager::afterFaceRemoved, this, _1, postNotification));
+    m_faceTable.beforeRemove.connect(bind(&FaceManager::afterFaceRemoved, this, _1, postNotification));
 }
 
 void
@@ -173,15 +172,14 @@
                                 const ControlParameters& parameters,
                                 const ndn::mgmt::CommandContinuation& done)
 {
-  auto result = extractLocalControlParameters(interest, parameters, done);
-  if (!result.isValid) {
+  Face* face = findFaceForLocalControl(interest, parameters, done);
+  if (!face) {
     return;
   }
 
   // TODO#3226 redesign enable-local-control
   // For now, enable-local-control will enable all local fields in GenericLinkService.
-  BOOST_ASSERT(result.lpFace != nullptr);
-  auto service = dynamic_cast<face::GenericLinkService*>(result.lpFace->getLinkService());
+  auto service = dynamic_cast<face::GenericLinkService*>(face->getLinkService());
   if (service == nullptr) {
     return done(ControlResponse(503, "LinkService type not supported"));
   }
@@ -199,15 +197,14 @@
                                  const ControlParameters& parameters,
                                  const ndn::mgmt::CommandContinuation& done)
 {
-  auto result = extractLocalControlParameters(interest, parameters, done);
-  if (!result.isValid) {
+  Face* face = findFaceForLocalControl(interest, parameters, done);
+  if (!face) {
     return;
   }
 
   // TODO#3226 redesign disable-local-control
   // For now, disable-local-control will disable all local fields in GenericLinkService.
-  BOOST_ASSERT(result.lpFace != nullptr);
-  auto service = dynamic_cast<face::GenericLinkService*>(result.lpFace->getLinkService());
+  auto service = dynamic_cast<face::GenericLinkService*>(face->getLinkService());
   if (service == nullptr) {
     return done(ControlResponse(503, "LinkService type not supported"));
   }
@@ -220,15 +217,11 @@
               .setBody(parameters.wireEncode()));
 }
 
-FaceManager::ExtractLocalControlParametersResult
-FaceManager::extractLocalControlParameters(const Interest& request,
-                                           const ControlParameters& parameters,
-                                           const ndn::mgmt::CommandContinuation& done)
+Face*
+FaceManager::findFaceForLocalControl(const Interest& request,
+                                     const ControlParameters& parameters,
+                                     const ndn::mgmt::CommandContinuation& done)
 {
-  ExtractLocalControlParametersResult result;
-  result.isValid = false;
-  result.lpFace = nullptr;
-
   shared_ptr<lp::IncomingFaceIdTag> incomingFaceIdTag = request.getTag<lp::IncomingFaceIdTag>();
   // NDNLPv2 says "application MUST be prepared to receive a packet without IncomingFaceId field",
   // but it's fine to assert IncomingFaceId is available, because InternalFace lives inside NFD
@@ -239,22 +232,16 @@
   if (face == nullptr) {
     NFD_LOG_DEBUG("FaceId " << *incomingFaceIdTag << " not found");
     done(ControlResponse(410, "Face not found"));
-    return result;
+    return nullptr;
   }
 
-  if (!face->isLocal()) {
+  if (face->getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL) {
     NFD_LOG_DEBUG("Cannot enable local control on non-local FaceId " << face->getId());
     done(ControlResponse(412, "Face is non-local"));
-    return result;
+    return nullptr;
   }
 
-  result.isValid = true;
-  auto lpFaceW = dynamic_pointer_cast<face::LpFaceWrapper>(face);
-  // LocalFace is gone, so a face that is local must be an LpFace.
-  BOOST_ASSERT(lpFaceW != nullptr);
-  result.lpFace = lpFaceW->getLpFace();
-
-  return result;
+  return face.get();
 }
 
 void
@@ -345,7 +332,7 @@
   }
 
   if (filter.hasFaceScope() &&
-      (filter.getFaceScope() == ndn::nfd::FACE_SCOPE_LOCAL) != face->isLocal()) {
+      filter.getFaceScope() != face->getScope()) {
     return false;
   }
 
@@ -355,7 +342,7 @@
   }
 
   if (filter.hasLinkType() &&
-      (filter.getLinkType() == ndn::nfd::LINK_TYPE_MULTI_ACCESS) != face->isMultiAccess()) {
+      filter.getLinkType() != face->getLinkType()) {
     return false;
   }
 
@@ -363,8 +350,8 @@
 }
 
 template<typename FaceTraits>
-inline void
-collectLpFaceProperties(const face::LpFace& face, FaceTraits& traits)
+void
+FaceManager::collectFaceProperties(const Face& face, FaceTraits& traits)
 {
   traits.setFaceId(face.getId())
         .setRemoteUri(face.getRemoteUri().toString())
@@ -372,27 +359,6 @@
         .setFaceScope(face.getScope())
         .setFacePersistency(face.getPersistency())
         .setLinkType(face.getLinkType());
-  // TODO#3172 replace this into FaceManager::collectFaceProperties
-}
-
-template<typename FaceTraits>
-void
-FaceManager::collectFaceProperties(const Face& face, FaceTraits& traits)
-{
-  auto lpFace = dynamic_cast<const face::LpFace*>(&face);
-  if (lpFace != nullptr) {
-    collectLpFaceProperties(*lpFace, traits);
-    return;
-  }
-
-  traits.setFaceId(face.getId())
-        .setRemoteUri(face.getRemoteUri().toString())
-        .setLocalUri(face.getLocalUri().toString())
-        .setFaceScope(face.isLocal() ? ndn::nfd::FACE_SCOPE_LOCAL
-                                     : ndn::nfd::FACE_SCOPE_NON_LOCAL)
-        .setFacePersistency(face.getPersistency())
-        .setLinkType(face.isMultiAccess() ? ndn::nfd::LINK_TYPE_MULTI_ACCESS
-                                          : ndn::nfd::LINK_TYPE_POINT_TO_POINT);
 }
 
 void
@@ -717,7 +683,7 @@
       m_factories.insert(std::make_pair("udp6", factory));
     }
 
-    std::set<shared_ptr<face::LpFaceWrapper>> multicastFacesToRemove;
+    std::set<shared_ptr<Face>> multicastFacesToRemove;
     for (const auto& i : factory->getMulticastFaces()) {
       multicastFacesToRemove.insert(i.second);
     }
@@ -799,7 +765,7 @@
       m_factories.insert(std::make_pair("ether", factory));
     }
 
-    std::set<shared_ptr<face::LpFaceWrapper>> multicastFacesToRemove;
+    std::set<shared_ptr<Face>> multicastFacesToRemove;
     for (const auto& i : factory->getMulticastFaces()) {
       multicastFacesToRemove.insert(i.second);
     }
diff --git a/daemon/mgmt/face-manager.hpp b/daemon/mgmt/face-manager.hpp
index 8e90a73..c2f43bb 100644
--- a/daemon/mgmt/face-manager.hpp
+++ b/daemon/mgmt/face-manager.hpp
@@ -29,18 +29,14 @@
 #include "manager-base.hpp"
 #include <ndn-cxx/management/nfd-face-status.hpp>
 #include <ndn-cxx/management/nfd-face-query-filter.hpp>
+#include "face/face.hpp"
 
 namespace nfd {
 
-class Face;
 class FaceTable;
 class NetworkInterfaceInfo;
 class ProtocolFactory;
 
-namespace face {
-class LpFace;
-} // namespace face
-
 /**
  * @brief implement the Face Management of NFD Management Protocol.
  * @sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt
@@ -89,16 +85,10 @@
   afterCreateFaceFailure(const std::string& reason,
                          const ndn::mgmt::CommandContinuation& done);
 
-  struct ExtractLocalControlParametersResult
-  {
-    bool isValid;
-    face::LpFace* lpFace;
-  };
-
-  ExtractLocalControlParametersResult
-  extractLocalControlParameters(const Interest& request,
-                                const ControlParameters& parameters,
-                                const ndn::mgmt::CommandContinuation& done);
+  Face*
+  findFaceForLocalControl(const Interest& request,
+                          const ControlParameters& parameters,
+                          const ndn::mgmt::CommandContinuation& done);
 
 PUBLIC_WITH_TESTS_ELSE_PRIVATE: // StatusDataset
   void
diff --git a/daemon/nfd.cpp b/daemon/nfd.cpp
index bcc5926..5d9ce22 100644
--- a/daemon/nfd.cpp
+++ b/daemon/nfd.cpp
@@ -91,8 +91,8 @@
   initializeManagement();
 
   FaceTable& faceTable = m_forwarder->getFaceTable();
-  faceTable.addReserved(face::makeNullFace(), FACEID_NULL);
-  faceTable.addReserved(face::makeNullFace(FaceUri("contentstore://")), FACEID_CONTENT_STORE);
+  faceTable.addReserved(face::makeNullFace(), face::FACEID_NULL);
+  faceTable.addReserved(face::makeNullFace(FaceUri("contentstore://")), face::FACEID_CONTENT_STORE);
 
   PrivilegeHelper::drop();
 
@@ -145,7 +145,7 @@
 Nfd::initializeManagement()
 {
   std::tie(m_internalFace, m_internalClientFace) = face::makeInternalFace(m_keyChain);
-  m_forwarder->getFaceTable().addReserved(m_internalFace, FACEID_INTERNAL_FACE);
+  m_forwarder->getFaceTable().addReserved(m_internalFace, face::FACEID_INTERNAL_FACE);
   m_dispatcher.reset(new ndn::mgmt::Dispatcher(*m_internalClientFace, m_keyChain));
 
   m_validator.reset(new CommandValidator());
diff --git a/daemon/nfd.hpp b/daemon/nfd.hpp
index 57b5e8a..dd97cf4 100644
--- a/daemon/nfd.hpp
+++ b/daemon/nfd.hpp
@@ -34,19 +34,14 @@
 #include <ndn-cxx/util/network-monitor.hpp>
 
 namespace ndn {
-
 class Face;
-
 namespace mgmt {
-
 class Dispatcher;
-
-}
-}
+} // namespace mgmt
+} // namespace ndn
 
 namespace nfd {
 
-class Face;
 class Forwarder;
 class FibManager;
 class FaceManager;
@@ -54,6 +49,10 @@
 class ForwarderStatusManager;
 class CommandValidator;
 
+namespace face {
+class Face;
+} // namespace face
+
 /**
  * \brief Class representing NFD instance
  * This class can be used to initialize all components of NFD
@@ -110,7 +109,7 @@
   unique_ptr<Forwarder> m_forwarder;
 
   ndn::KeyChain&               m_keyChain;
-  shared_ptr<Face>             m_internalFace;
+  shared_ptr<face::Face>       m_internalFace;
   shared_ptr<ndn::Face>        m_internalClientFace;
   unique_ptr<CommandValidator> m_validator;
 
diff --git a/daemon/table/pit-entry.cpp b/daemon/table/pit-entry.cpp
index 85ea19c..22df4a4 100644
--- a/daemon/table/pit-entry.cpp
+++ b/daemon/table/pit-entry.cpp
@@ -1,12 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014,  Regents of the University of California,
- *                      Arizona Board of Regents,
- *                      Colorado State University,
- *                      University Pierre & Marie Curie, Sorbonne University,
- *                      Washington University in St. Louis,
- *                      Beijing Institute of Technology,
- *                      The University of Memphis
+ * Copyright (c) 2014-2015,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -47,7 +47,7 @@
 Entry::hasLocalInRecord() const
 {
   return std::any_of(m_inRecords.begin(), m_inRecords.end(),
-                     [] (const InRecord& inRecord) { return inRecord.getFace()->isLocal(); });
+    [] (const InRecord& inRecord) { return inRecord.getFace()->getScope() == ndn::nfd::FACE_SCOPE_LOCAL; });
 }
 
 bool
@@ -78,14 +78,14 @@
 Entry::violatesScope(const Face& face) const
 {
   // /localhost scope
-  bool isViolatingLocalhost = !face.isLocal() &&
+  bool isViolatingLocalhost = face.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL &&
                               LOCALHOST_NAME.isPrefixOf(this->getName());
   if (isViolatingLocalhost) {
     return true;
   }
 
   // /localhop scope
-  bool isViolatingLocalhop = !face.isLocal() &&
+  bool isViolatingLocalhop = face.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL &&
                              LOCALHOP_NAME.isPrefixOf(this->getName()) &&
                              !this->hasLocalInRecord();
   if (isViolatingLocalhop) {
diff --git a/tests/daemon/face/dummy-lp-face.cpp b/tests/daemon/face/dummy-face.cpp
similarity index 77%
rename from tests/daemon/face/dummy-lp-face.cpp
rename to tests/daemon/face/dummy-face.cpp
index 20fb20d..c4f6154 100644
--- a/tests/daemon/face/dummy-lp-face.cpp
+++ b/tests/daemon/face/dummy-face.cpp
@@ -23,14 +23,14 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "dummy-lp-face.hpp"
+#include "dummy-face.hpp"
 #include "dummy-transport.hpp"
 
 namespace nfd {
 namespace face {
 namespace tests {
 
-class DummyLpFace::LinkService : public face::LinkService
+class DummyFace::LinkService : public face::LinkService
 {
 public:
   void
@@ -51,28 +51,28 @@
     this->face::LinkService::receiveNack(nack);
   }
 
-  signal::Signal<LinkService> afterSend;
+  signal::Signal<LinkService, uint32_t> afterSend;
 
 private:
   virtual void
   doSendInterest(const Interest& interest) DECL_OVERRIDE
   {
     this->sentInterests.push_back(interest);
-    this->afterSend();
+    this->afterSend(tlv::Interest);
   }
 
   virtual void
   doSendData(const Data& data) DECL_OVERRIDE
   {
     this->sentData.push_back(data);
-    this->afterSend();
+    this->afterSend(tlv::Data);
   }
 
   virtual void
   doSendNack(const lp::Nack& nack) DECL_OVERRIDE
   {
     this->sentNacks.push_back(nack);
-    this->afterSend();
+    this->afterSend(lp::tlv::Nack);
   }
 
   virtual void
@@ -87,11 +87,11 @@
   std::vector<lp::Nack> sentNacks;
 };
 
-DummyLpFace::DummyLpFace(const std::string& localUri, const std::string& remoteUri,
-                         ndn::nfd::FaceScope scope, ndn::nfd::FacePersistency persistency,
-                         ndn::nfd::LinkType linkType)
-  : LpFace(make_unique<LinkService>(),
-           make_unique<DummyTransport>(localUri, remoteUri, scope, persistency, linkType))
+DummyFace::DummyFace(const std::string& localUri, const std::string& remoteUri,
+                     ndn::nfd::FaceScope scope, ndn::nfd::FacePersistency persistency,
+                     ndn::nfd::LinkType linkType)
+  : Face(make_unique<LinkService>(),
+         make_unique<DummyTransport>(localUri, remoteUri, scope, persistency, linkType))
   , afterSend(this->getLinkServiceInternal()->afterSend)
   , sentInterests(this->getLinkServiceInternal()->sentInterests)
   , sentData(this->getLinkServiceInternal()->sentData)
@@ -100,37 +100,37 @@
 }
 
 void
-DummyLpFace::setState(FaceState state)
+DummyFace::setState(FaceState state)
 {
   this->getTransportInternal()->setState(state);
 }
 
 void
-DummyLpFace::receiveInterest(const Interest& interest)
+DummyFace::receiveInterest(const Interest& interest)
 {
   this->getLinkServiceInternal()->receiveInterest(interest);
 }
 
 void
-DummyLpFace::receiveData(const Data& data)
+DummyFace::receiveData(const Data& data)
 {
   this->getLinkServiceInternal()->receiveData(data);
 }
 
 void
-DummyLpFace::receiveNack(const lp::Nack& nack)
+DummyFace::receiveNack(const lp::Nack& nack)
 {
   this->getLinkServiceInternal()->receiveNack(nack);
 }
 
-DummyLpFace::LinkService*
-DummyLpFace::getLinkServiceInternal()
+DummyFace::LinkService*
+DummyFace::getLinkServiceInternal()
 {
   return static_cast<LinkService*>(this->getLinkService());
 }
 
 DummyTransport*
-DummyLpFace::getTransportInternal()
+DummyFace::getTransportInternal()
 {
   return static_cast<DummyTransport*>(this->getTransport());
 }
diff --git a/tests/daemon/face/dummy-face.hpp b/tests/daemon/face/dummy-face.hpp
index 6ed7d46..34f2d09 100644
--- a/tests/daemon/face/dummy-face.hpp
+++ b/tests/daemon/face/dummy-face.hpp
@@ -29,71 +29,78 @@
 #include "face/face.hpp"
 
 namespace nfd {
+namespace face {
 namespace tests {
 
+class DummyTransport;
+
 /** \brief a Face for unit testing
+ *
+ *  The DummyFace has no underlying transport, but allows observing outgoing packets
+ *  and injecting incoming packets at network layer.
+ *  It's primarily used for forwarding test suites, but can be used in other tests as well.
+ *
+ *  Outgoing network-layer packets sent through the DummyFace are recorded in sent* vectors,
+ *  which can be observed in test cases.
+ *  Incoming network-layer packets can be injected from test cases through receive* method.
  */
 class DummyFace : public Face
 {
 public:
-  explicit
-  DummyFace(const std::string& remoteUri = "dummy://", const std::string& localUri = "dummy://",
-            bool isLocal = false)
-    : Face(FaceUri(remoteUri), FaceUri(localUri), isLocal)
-  {
-  }
+  class LinkService;
 
+  DummyFace(const std::string& localUri = "dummy://", const std::string& remoteUri = "dummy://",
+            ndn::nfd::FaceScope scope = ndn::nfd::FACE_SCOPE_NON_LOCAL,
+            ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+            ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_POINT_TO_POINT);
+
+  /** \brief changes face state
+   *  \pre current state is not CLOSED or FAILED
+   */
   void
-  sendInterest(const Interest& interest) DECL_OVERRIDE
-  {
-    this->emitSignal(onSendInterest, interest);
-    m_sentInterests.push_back(interest);
-    this->afterSend();
-  }
+  setState(FaceState state);
 
+  /** \brief causes the face to receive an Interest
+   */
   void
-  sendData(const Data& data) DECL_OVERRIDE
-  {
-    this->emitSignal(onSendData, data);
-    m_sentDatas.push_back(data);
-    this->afterSend();
-  }
+  receiveInterest(const Interest& interest);
 
+  /** \brief causes the face to receive a Data
+   */
   void
-  close() DECL_OVERRIDE
-  {
-    this->fail("close");
-  }
+  receiveData(const Data& data);
 
+  /** \brief causes the face to receive a Nack
+   */
   void
-  receiveInterest(const Interest& interest)
-  {
-    this->emitSignal(onReceiveInterest, interest);
-  }
+  receiveNack(const lp::Nack& nack);
 
-  void
-  receiveData(const Data& data)
-  {
-    this->emitSignal(onReceiveData, data);
-  }
+  /** \brief signals after any network-layer packet is sent
+   *
+   *  The network-layer packet type is indicated as an argument,
+   *  which is either of tlv::Interest, tlv::Data, or lp::tlv::Nack.
+   *  The callback may retrieve the packet from sentInterests.back(), sentData.back(), or sentNacks.back().
+   */
+  signal::Signal<LinkService, uint32_t>& afterSend;
 
-  signal::Signal<DummyFace> afterSend;
+private:
+  LinkService*
+  getLinkServiceInternal();
+
+  DummyTransport*
+  getTransportInternal();
 
 public:
-  std::vector<Interest> m_sentInterests;
-  std::vector<Data> m_sentDatas;
+  std::vector<Interest>& sentInterests;
+  std::vector<Data>& sentData;
+  std::vector<lp::Nack>& sentNacks;
 };
 
-class DummyLocalFace : public DummyFace
-{
-public:
-  explicit
-  DummyLocalFace(const std::string& remoteUri = "dummy://", const std::string& localUri = "dummy://")
-    : DummyFace(remoteUri, localUri, true)
-  {
-  }
-};
+} // namespace tests
+} // namespace face
 
+namespace tests {
+using nfd::face::tests::DummyFace;
 } // namespace tests
 } // namespace nfd
 
diff --git a/tests/daemon/face/dummy-lp-face.hpp b/tests/daemon/face/dummy-lp-face.hpp
deleted file mode 100644
index 588cb59..0000000
--- a/tests/daemon/face/dummy-lp-face.hpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  Regents of the University of California,
- *                           Arizona Board of Regents,
- *                           Colorado State University,
- *                           University Pierre & Marie Curie, Sorbonne University,
- *                           Washington University in St. Louis,
- *                           Beijing Institute of Technology,
- *                           The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NFD_TESTS_DAEMON_FACE_DUMMY_LP_FACE_HPP
-#define NFD_TESTS_DAEMON_FACE_DUMMY_LP_FACE_HPP
-
-#include "face/lp-face.hpp"
-
-namespace nfd {
-namespace face {
-namespace tests {
-
-class DummyTransport;
-
-/** \brief a LpFace for unit testing
- *
- *  The DummyLpFace allows observing outgoing network-layer packets,
- *  and allows incoming network-layer packets to be injected from a test suite.
- *  It's primarily used for forwarding test suites, but can be used in other tests as well.
- */
-class DummyLpFace : public LpFace
-{
-public:
-  class LinkService;
-
-  DummyLpFace(const std::string& localUri = "dummy://", const std::string& remoteUri = "dummy://",
-              ndn::nfd::FaceScope scope = ndn::nfd::FACE_SCOPE_NON_LOCAL,
-              ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-              ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_POINT_TO_POINT);
-
-  /** \brief changes face state
-   *  \pre current state is not CLOSED or FAILED
-   */
-  void
-  setState(FaceState state);
-
-  /** \brief causes the face to receive an Interest
-   */
-  void
-  receiveInterest(const Interest& interest);
-
-  /** \brief causes the face to receive a Data
-   */
-  void
-  receiveData(const Data& data);
-
-  /** \brief causes the face to receive a Nack
-   */
-  void
-  receiveNack(const lp::Nack& nack);
-
-  /** \brief signals after any network-layer packet is sent
-   */
-  signal::Signal<LinkService>& afterSend;
-
-private:
-  LinkService*
-  getLinkServiceInternal();
-
-  DummyTransport*
-  getTransportInternal();
-
-public:
-  std::vector<Interest>& sentInterests;
-  std::vector<Data>& sentData;
-  std::vector<lp::Nack>& sentNacks;
-};
-
-} // namespace tests
-} // namespace face
-
-namespace tests {
-using nfd::face::tests::DummyLpFace;
-} // namespace tests
-} // namespace nfd
-
-#endif // NFD_TESTS_DAEMON_FACE_DUMMY_LP_FACE_HPP
diff --git a/tests/daemon/face/dummy-stream-sender.hpp b/tests/daemon/face/dummy-stream-sender.hpp
deleted file mode 100644
index 7cbb4e2..0000000
--- a/tests/daemon/face/dummy-stream-sender.hpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014,  Regents of the University of California,
- *                      Arizona Board of Regents,
- *                      Colorado State University,
- *                      University Pierre & Marie Curie, Sorbonne University,
- *                      Washington University in St. Louis,
- *                      Beijing Institute of Technology,
- *                      The University of Memphis
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NFD_TESTS_DAEMON_FACE_DUMMY_STREAM_SENDER_HPP
-#define NFD_TESTS_DAEMON_FACE_DUMMY_STREAM_SENDER_HPP
-
-#include "core/scheduler.hpp"
-#include "core/global-io.hpp"
-
-namespace nfd {
-namespace tests {
-
-
-template<class Protocol, class Dataset>
-class DummyStreamSender : public Dataset
-{
-public:
-  typedef typename Protocol::endpoint Endpoint;
-  typedef typename Protocol::socket Socket;
-
-  class Error : public std::runtime_error
-  {
-  public:
-    explicit
-    Error(const std::string& what)
-      : std::runtime_error(what)
-    {
-    }
-  };
-
-  DummyStreamSender()
-    : socket(getGlobalIoService())
-  {
-  }
-
-  void
-  start(const Endpoint& endpoint)
-  {
-    socket.async_connect(endpoint,
-                         bind(&DummyStreamSender::onSuccessfullConnect, this, _1));
-  }
-
-  void
-  onSuccessfullConnect(const boost::system::error_code& error)
-  {
-    if (error)
-      {
-        BOOST_THROW_EXCEPTION(Error("Connection aborted"));
-      }
-
-    // This value may need to be adjusted if some dataset exceeds 100k
-    socket.set_option(boost::asio::socket_base::send_buffer_size(100000));
-
-    for (typename Dataset::Container::iterator i = this->data.begin();
-         i != this->data.end(); ++i)
-      {
-        socket.async_send(boost::asio::buffer(*i),
-                          bind(&DummyStreamSender::onSendFinished, this, _1, false));
-      }
-
-    socket.async_send(boost::asio::buffer(static_cast<const uint8_t*>(0), 0),
-                      bind(&DummyStreamSender::onSendFinished, this, _1, true));
-  }
-
-  void
-  onSendFinished(const boost::system::error_code& error, bool isFinal)
-  {
-    if (error) {
-      BOOST_THROW_EXCEPTION(Error("Connection aborted"));
-    }
-
-    if (isFinal) {
-      scheduler::schedule(ndn::time::seconds(1),
-                          bind(&DummyStreamSender::stop, this));
-    }
-  }
-
-  void
-  stop()
-  {
-    // Terminate test
-    boost::system::error_code error;
-    socket.shutdown(Socket::shutdown_both, error);
-    socket.close(error);
-  }
-
-public:
-  Socket socket;
-};
-
-} // namespace tests
-} // namespace nfd
-
-#endif // NFD_TESTS_DAEMON_FACE_DUMMY_STREAM_SENDER_HPP
diff --git a/tests/daemon/face/dummy-transport.hpp b/tests/daemon/face/dummy-transport.hpp
index ce2833b..f957e1e 100644
--- a/tests/daemon/face/dummy-transport.hpp
+++ b/tests/daemon/face/dummy-transport.hpp
@@ -91,6 +91,7 @@
   doClose() DECL_OVERRIDE
   {
     isClosed = true;
+    this->setState(TransportState::CLOSED);
   }
 
   virtual void
diff --git a/tests/daemon/face/ethernet-factory.t.cpp b/tests/daemon/face/ethernet-factory.t.cpp
new file mode 100644
index 0000000..6148b3b
--- /dev/null
+++ b/tests/daemon/face/ethernet-factory.t.cpp
@@ -0,0 +1,91 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "face/ethernet-factory.hpp"
+
+#include "network-interface-fixture.hpp"
+
+namespace nfd {
+namespace tests {
+
+using nfd::face::tests::NetworkInterfaceFixture;
+
+BOOST_AUTO_TEST_SUITE(Face)
+BOOST_FIXTURE_TEST_SUITE(TestEthernetFactory, NetworkInterfaceFixture)
+
+BOOST_AUTO_TEST_CASE(GetChannels)
+{
+  EthernetFactory factory;
+
+  auto channels = factory.getChannels();
+  BOOST_CHECK_EQUAL(channels.empty(), true);
+}
+
+BOOST_AUTO_TEST_CASE(MulticastFacesMap)
+{
+  SKIP_IF_NETWORK_INTERFACE_COUNT_LT(1);
+
+  EthernetFactory factory;
+  auto face1 = factory.createMulticastFace(m_interfaces.front(), ethernet::getBroadcastAddress());
+  auto face1bis = factory.createMulticastFace(m_interfaces.front(), ethernet::getBroadcastAddress());
+  BOOST_CHECK_EQUAL(face1, face1bis);
+
+  auto face2 = factory.createMulticastFace(m_interfaces.front(), ethernet::getDefaultMulticastAddress());
+  BOOST_CHECK_NE(face1, face2);
+
+  SKIP_IF_NETWORK_INTERFACE_COUNT_LT(2);
+
+  auto face3 = factory.createMulticastFace(m_interfaces.back(), ethernet::getBroadcastAddress());
+  BOOST_CHECK_NE(face1, face3);
+}
+
+BOOST_AUTO_TEST_CASE(UnsupportedFaceCreate)
+{
+  EthernetFactory factory;
+
+  BOOST_CHECK_THROW(factory.createFace(FaceUri("ether://[08:00:27:01:01:01]"),
+                                       ndn::nfd::FACE_PERSISTENCY_PERMANENT,
+                                       bind([]{}),
+                                       bind([]{})),
+                    ProtocolFactory::Error);
+
+  BOOST_CHECK_THROW(factory.createFace(FaceUri("ether://[08:00:27:01:01:01]"),
+                                       ndn::nfd::FACE_PERSISTENCY_ON_DEMAND,
+                                       bind([]{}),
+                                       bind([]{})),
+                    ProtocolFactory::Error);
+
+  BOOST_CHECK_THROW(factory.createFace(FaceUri("ether://[08:00:27:01:01:01]"),
+                                       ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+                                       bind([]{}),
+                                       bind([]{})),
+                    ProtocolFactory::Error);
+}
+
+BOOST_AUTO_TEST_SUITE_END() // TestEthernetFactory
+BOOST_AUTO_TEST_SUITE_END() // Face
+
+} // namespace tests
+} // namespace nfd
diff --git a/tests/daemon/face/ethernet-transport.t.cpp b/tests/daemon/face/ethernet-transport.t.cpp
index 1e02173..f7948a2 100644
--- a/tests/daemon/face/ethernet-transport.t.cpp
+++ b/tests/daemon/face/ethernet-transport.t.cpp
@@ -52,6 +52,10 @@
   BOOST_CHECK_EQUAL(transport.getLinkType(), ndn::nfd::LINK_TYPE_MULTI_ACCESS);
 }
 
+// TODO add the equivalent of these test cases from ethernet.t.cpp as of commit:65caf200924b28748037750449e28bcb548dbc9c
+// SendPacket
+// ProcessIncomingPacket
+
 BOOST_AUTO_TEST_SUITE_END() // TestEthernetTransport
 BOOST_AUTO_TEST_SUITE_END() // Face
 
diff --git a/tests/daemon/face/ethernet.t.cpp b/tests/daemon/face/ethernet.t.cpp
deleted file mode 100644
index 2b1d2de..0000000
--- a/tests/daemon/face/ethernet.t.cpp
+++ /dev/null
@@ -1,231 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  Regents of the University of California,
- *                           Arizona Board of Regents,
- *                           Colorado State University,
- *                           University Pierre & Marie Curie, Sorbonne University,
- *                           Washington University in St. Louis,
- *                           Beijing Institute of Technology,
- *                           The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "face/ethernet-factory.hpp"
-#include "face/ethernet-transport.hpp"
-
-#include "face/lp-face-wrapper.hpp"
-#include "network-interface-fixture.hpp"
-
-#include <pcap/pcap.h>
-
-namespace nfd {
-namespace tests {
-
-using nfd::face::tests::NetworkInterfaceFixture;
-
-BOOST_AUTO_TEST_SUITE(Face)
-BOOST_FIXTURE_TEST_SUITE(TestEthernet, NetworkInterfaceFixture)
-
-using nfd::Face;
-
-BOOST_AUTO_TEST_CASE(GetChannels)
-{
-  EthernetFactory factory;
-
-  auto channels = factory.getChannels();
-  BOOST_CHECK_EQUAL(channels.empty(), true);
-}
-
-BOOST_AUTO_TEST_CASE(MulticastFacesMap)
-{
-  SKIP_IF_NETWORK_INTERFACE_COUNT_LT(1);
-
-  EthernetFactory factory;
-  auto face1 = factory.createMulticastFace(m_interfaces.front(), ethernet::getBroadcastAddress());
-  auto face1bis = factory.createMulticastFace(m_interfaces.front(), ethernet::getBroadcastAddress());
-  BOOST_CHECK_EQUAL(face1, face1bis);
-
-  auto face2 = factory.createMulticastFace(m_interfaces.front(), ethernet::getDefaultMulticastAddress());
-  BOOST_CHECK_NE(face1, face2);
-
-  SKIP_IF_NETWORK_INTERFACE_COUNT_LT(2);
-
-  auto face3 = factory.createMulticastFace(m_interfaces.back(), ethernet::getBroadcastAddress());
-  BOOST_CHECK_NE(face1, face3);
-}
-
-BOOST_AUTO_TEST_CASE(UnsupportedFaceCreate)
-{
-  EthernetFactory factory;
-
-  BOOST_CHECK_THROW(factory.createFace(FaceUri("ether://[08:00:27:01:01:01]"),
-                                       ndn::nfd::FACE_PERSISTENCY_PERMANENT,
-                                       bind([]{}),
-                                       bind([]{})),
-                    ProtocolFactory::Error);
-
-  BOOST_CHECK_THROW(factory.createFace(FaceUri("ether://[08:00:27:01:01:01]"),
-                                       ndn::nfd::FACE_PERSISTENCY_ON_DEMAND,
-                                       bind([]{}),
-                                       bind([]{})),
-                    ProtocolFactory::Error);
-
-  BOOST_CHECK_THROW(factory.createFace(FaceUri("ether://[08:00:27:01:01:01]"),
-                                       ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-                                       bind([]{}),
-                                       bind([]{})),
-                    ProtocolFactory::Error);
-}
-
-BOOST_AUTO_TEST_CASE(SendPacket)
-{
-  SKIP_IF_NETWORK_INTERFACE_COUNT_LT(1);
-
-  EthernetFactory factory;
-  auto face = factory.createMulticastFace(m_interfaces.front(), ethernet::getDefaultMulticastAddress());
-
-  BOOST_REQUIRE(static_cast<bool>(face));
-  BOOST_CHECK_EQUAL(face->isLocal(), false);
-  BOOST_CHECK_EQUAL(face->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERMANENT);
-  BOOST_CHECK_EQUAL(face->isMultiAccess(), true);
-  BOOST_CHECK_EQUAL(face->getRemoteUri().toString(),
-                    "ether://[" + ethernet::getDefaultMulticastAddress().toString() + "]");
-  BOOST_CHECK_EQUAL(face->getLocalUri().toString(),
-                    "dev://" + m_interfaces.front().name);
-  BOOST_CHECK_EQUAL(face->getCounters().nInBytes, 0);
-  BOOST_CHECK_EQUAL(face->getCounters().nOutBytes, 0);
-
-  face->onFail.connect([] (const std::string& reason) { BOOST_FAIL(reason); });
-
-  shared_ptr<Interest> interest1 = makeInterest("ndn:/TpnzGvW9R");
-  shared_ptr<Data>     data1     = makeData("ndn:/KfczhUqVix");
-  shared_ptr<Interest> interest2 = makeInterest("ndn:/QWiIMfj5sL");
-  shared_ptr<Data>     data2     = makeData("ndn:/XNBV796f");
-
-  face->sendInterest(*interest1);
-  face->sendData    (*data1    );
-  face->sendInterest(*interest2);
-  face->sendData    (*data2    );
-
-  BOOST_CHECK_EQUAL(face->getCounters().nOutBytes,
-                    interest1->wireEncode().size() +
-                    data1->wireEncode().size() +
-                    interest2->wireEncode().size() +
-                    data2->wireEncode().size());
-}
-
-BOOST_AUTO_TEST_CASE(ProcessIncomingPacket)
-{
-  SKIP_IF_NETWORK_INTERFACE_COUNT_LT(1);
-
-  EthernetFactory factory;
-  auto face = factory.createMulticastFace(m_interfaces.front(), ethernet::getDefaultMulticastAddress());
-  BOOST_REQUIRE(static_cast<bool>(face));
-
-  auto transport = dynamic_cast<face::EthernetTransport*>(face->getLpFace()->getTransport());
-  BOOST_REQUIRE(transport != nullptr);
-
-  std::vector<Interest> recInterests;
-  std::vector<Data>     recDatas;
-
-  face->onFail.connect([] (const std::string& reason) { BOOST_FAIL(reason); });
-  face->onReceiveInterest.connect(
-      [&recInterests] (const Interest& i) { recInterests.push_back(i); });
-  face->onReceiveData.connect([&recDatas] (const Data& d) { recDatas.push_back(d); });
-
-  // check that packet data is not accessed if pcap didn't capture anything (caplen == 0)
-  static const pcap_pkthdr zeroHeader{};
-  transport->processIncomingPacket(&zeroHeader, nullptr);
-  BOOST_CHECK_EQUAL(face->getCounters().nInBytes, 0);
-  BOOST_CHECK_EQUAL(recInterests.size(), 0);
-  BOOST_CHECK_EQUAL(recDatas.size(), 0);
-
-  // runt frame (too short)
-  pcap_pkthdr runtHeader{};
-  runtHeader.caplen = ethernet::HDR_LEN + 6;
-  static const uint8_t packet2[ethernet::HDR_LEN + 6]{};
-  transport->processIncomingPacket(&runtHeader, packet2);
-  BOOST_CHECK_EQUAL(face->getCounters().nInBytes, 0);
-  BOOST_CHECK_EQUAL(recInterests.size(), 0);
-  BOOST_CHECK_EQUAL(recDatas.size(), 0);
-
-  // valid frame, but TLV block has invalid length
-  pcap_pkthdr validHeader{};
-  validHeader.caplen = ethernet::HDR_LEN + ethernet::MIN_DATA_LEN;
-  static const uint8_t packet3[ethernet::HDR_LEN + ethernet::MIN_DATA_LEN]{
-    0x01, 0x00, 0x5e, 0x00, 0x17, 0xaa, // destination address
-    0x02, 0x00, 0x00, 0x00, 0x00, 0x02, // source address
-    0x86, 0x24,       // NDN ethertype
-    tlv::Interest,    // TLV type
-    0xfd, 0xff, 0xff  // TLV length (invalid because greater than buffer size)
-  };
-  transport->processIncomingPacket(&validHeader, packet3);
-  BOOST_CHECK_EQUAL(face->getCounters().nInBytes, 0);
-  BOOST_CHECK_EQUAL(recInterests.size(), 0);
-  BOOST_CHECK_EQUAL(recDatas.size(), 0);
-
-  // valid frame, but TLV block has invalid type
-  static const uint8_t packet4[ethernet::HDR_LEN + ethernet::MIN_DATA_LEN]{
-    0x01, 0x00, 0x5e, 0x00, 0x17, 0xaa, // destination address
-    0x02, 0x00, 0x00, 0x00, 0x00, 0x02, // source address
-    0x86, 0x24,       // NDN ethertype
-    0x00,             // TLV type (invalid)
-    0x00              // TLV length
-  };
-  transport->processIncomingPacket(&validHeader, packet4);
-  BOOST_CHECK_EQUAL(face->getCounters().nInBytes, 2);
-  BOOST_CHECK_EQUAL(recInterests.size(), 0);
-  BOOST_CHECK_EQUAL(recDatas.size(), 0);
-
-  // valid frame and valid NDNLPv2 packet, but invalid network-layer packet
-  static const uint8_t packet5[ethernet::HDR_LEN + ethernet::MIN_DATA_LEN]{
-    0x01, 0x00, 0x5e, 0x00, 0x17, 0xaa, // destination address
-    0x02, 0x00, 0x00, 0x00, 0x00, 0x02, // source address
-    0x86, 0x24,                         // NDN ethertype
-    lp::tlv::LpPacket, 0x04,            // start of NDNLPv2 packet
-    lp::tlv::Fragment, 0x02,            // single fragment
-    0x00,             // TLV type (invalid)
-    0x00              // TLV length
-  };
-  transport->processIncomingPacket(&validHeader, packet5);
-  BOOST_CHECK_EQUAL(face->getCounters().nInBytes, 8);
-  BOOST_CHECK_EQUAL(recInterests.size(), 0);
-  BOOST_CHECK_EQUAL(recDatas.size(), 0);
-
-  // valid frame, valid NDNLPv2 packet, and valid NDN (interest) packet
-  static const uint8_t packet6[ethernet::HDR_LEN + ethernet::MIN_DATA_LEN]{
-    0x01, 0x00, 0x5e, 0x00, 0x17, 0xaa, // destination address
-    0x02, 0x00, 0x00, 0x00, 0x00, 0x02, // source address
-    0x86, 0x24,                         // NDN ethertype
-    lp::tlv::LpPacket, 0x1a,            // start of NDNLPv2 packet
-    lp::tlv::Fragment, 0x18,            // single fragment
-    tlv::Interest, 0x16,                // start of NDN packet
-    0x07, 0x0e, 0x08, 0x07, 0x65, 0x78, // payload
-    0x61, 0x6d, 0x70, 0x6c, 0x65, 0x08,
-    0x03, 0x66, 0x6f, 0x6f, 0x0a, 0x04,
-    0x03, 0xef, 0xe9, 0x7c
-  };
-  transport->processIncomingPacket(&validHeader, packet6);
-  BOOST_CHECK_EQUAL(face->getCounters().nInBytes, 36);
-  BOOST_CHECK_EQUAL(recInterests.size(), 1);
-  BOOST_CHECK_EQUAL(recDatas.size(), 0);
-}
-
-BOOST_AUTO_TEST_SUITE_END() // TestEthernet
-BOOST_AUTO_TEST_SUITE_END() // Face
-
-} // namespace tests
-} // namespace nfd
diff --git a/tests/daemon/face/face-history.hpp b/tests/daemon/face/face-history.hpp
deleted file mode 100644
index 263a23a..0000000
--- a/tests/daemon/face/face-history.hpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  Regents of the University of California,
- *                           Arizona Board of Regents,
- *                           Colorado State University,
- *                           University Pierre & Marie Curie, Sorbonne University,
- *                           Washington University in St. Louis,
- *                           Beijing Institute of Technology,
- *                           The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NFD_TESTS_DAEMON_FACE_FACE_HISTORY_HPP
-#define NFD_TESTS_DAEMON_FACE_FACE_HISTORY_HPP
-
-#include "face/face.hpp"
-
-namespace nfd {
-namespace tests {
-
-/** \brief captures signals from Face
- */
-class FaceHistory : noncopyable
-{
-public:
-  explicit
-  FaceHistory(Face& face)
-    : m_limitedIo(nullptr)
-  {
-    this->construct(face);
-  }
-
-  FaceHistory(Face& face, LimitedIo& limitedIo)
-    : m_limitedIo(&limitedIo)
-  {
-    this->construct(face);
-  }
-
-private:
-  void
-  construct(Face& face)
-  {
-    m_receiveInterestConn = face.onReceiveInterest.connect([this] (const Interest& interest) {
-      this->receivedInterests.push_back(interest);
-      this->afterOp();
-    });
-    m_receiveDataConn = face.onReceiveData.connect([this] (const Data& data) {
-      this->receivedData.push_back(data);
-      this->afterOp();
-    });
-    m_failConn = face.onFail.connect([this] (const std::string& reason) {
-      this->failures.push_back(reason);
-      this->afterOp();
-    });
-  }
-
-  void
-  afterOp()
-  {
-    if (m_limitedIo != nullptr) {
-      m_limitedIo->afterOp();
-    }
-  }
-
-public:
-  std::vector<Interest> receivedInterests;
-  std::vector<Data> receivedData;
-  std::vector<std::string> failures;
-
-private:
-  LimitedIo* m_limitedIo;
-  signal::ScopedConnection m_receiveInterestConn;
-  signal::ScopedConnection m_receiveDataConn;
-  signal::ScopedConnection m_failConn;
-};
-
-} // namespace tests
-} // namespace nfd
-
-#endif // NFD_TESTS_DAEMON_FACE_FACE_HISTORY_HPP
diff --git a/tests/daemon/face/face.t.cpp b/tests/daemon/face/face.t.cpp
index 4a94a58..7d0dba0 100644
--- a/tests/daemon/face/face.t.cpp
+++ b/tests/daemon/face/face.t.cpp
@@ -24,60 +24,89 @@
  */
 
 #include "face/face.hpp"
-#include "dummy-face.hpp"
 
 #include "tests/test-common.hpp"
+#include "dummy-face.hpp"
 
 namespace nfd {
+namespace face {
 namespace tests {
 
-BOOST_FIXTURE_TEST_SUITE(FaceFace, BaseFixture)
+using namespace nfd::tests;
 
-BOOST_AUTO_TEST_CASE(Description)
+BOOST_AUTO_TEST_SUITE(Face)
+BOOST_FIXTURE_TEST_SUITE(TestFace, BaseFixture)
+
+// TODO add test cases for getLinkService, getTransport
+// TODO add a test case for static properties
+// TODO add a test case for getState
+
+BOOST_AUTO_TEST_CASE(LinkServiceSendReceive)
 {
-  DummyFace face;
-  face.setDescription("3pFsKrvWr");
-  BOOST_CHECK_EQUAL(face.getDescription(), "3pFsKrvWr");
+  auto face1 = make_shared<DummyFace>();
+
+  const size_t nInInterests = 192;
+  const size_t nInData = 91;
+  const size_t nInNacks = 29;
+  const size_t nOutInterests = 202;
+  const size_t nOutData = 128;
+  const size_t nOutNacks = 84;
+
+  size_t nReceivedInterests = 0;
+  size_t nReceivedData = 0;
+  size_t nReceivedNacks = 0;
+  face1->afterReceiveInterest.connect(bind([&nReceivedInterests] { ++nReceivedInterests; }));
+  face1->afterReceiveData.connect(bind([&nReceivedData] { ++nReceivedData; }));
+  face1->afterReceiveNack.connect(bind([&nReceivedNacks] { ++nReceivedNacks; }));
+
+  for (size_t i = 0; i < nInInterests; ++i) {
+    shared_ptr<Interest> interest = makeInterest("/JSQdqward4");
+    face1->receiveInterest(*interest);
+  }
+
+  for (size_t i = 0; i < nInData; ++i) {
+    shared_ptr<Data> data = makeData("/hT8FDigWn1");
+    face1->receiveData(*data);
+  }
+
+  for (size_t i = 0; i < nInNacks; ++i) {
+    lp::Nack nack = makeNack("/StnEVTj4Ex", 561, lp::NackReason::CONGESTION);
+    face1->receiveNack(nack);
+  }
+
+  for (size_t i = 0; i < nOutInterests; ++i) {
+    shared_ptr<Interest> interest = makeInterest("/XyUAFYQDmd");
+    face1->sendInterest(*interest);
+  }
+
+  for (size_t i = 0; i < nOutData; ++i) {
+    shared_ptr<Data> data = makeData("/GigPEtPH6");
+    face1->sendData(*data);
+  }
+
+  for (size_t i = 0; i < nOutNacks; ++i) {
+    lp::Nack nack = makeNack("/9xK6FbwIBM", 365, lp::NackReason::CONGESTION);
+    face1->sendNack(nack);
+  }
+
+  BOOST_CHECK_EQUAL(face1->getCounters().nInInterests, nInInterests);
+  BOOST_CHECK_EQUAL(face1->getCounters().nInData, nInData);
+  BOOST_CHECK_EQUAL(face1->getCounters().nInNacks, nInNacks);
+  BOOST_CHECK_EQUAL(face1->getCounters().nOutInterests, nOutInterests);
+  BOOST_CHECK_EQUAL(face1->getCounters().nOutData, nOutData);
+  BOOST_CHECK_EQUAL(face1->getCounters().nOutNacks, nOutNacks);
+
+  BOOST_CHECK_EQUAL(nReceivedInterests, nInInterests);
+  BOOST_CHECK_EQUAL(nReceivedData, nInData);
+  BOOST_CHECK_EQUAL(nReceivedNacks, nInNacks);
+  BOOST_CHECK_EQUAL(face1->sentInterests.size(), nOutInterests);
+  BOOST_CHECK_EQUAL(face1->sentData.size(), nOutData);
+  BOOST_CHECK_EQUAL(face1->sentNacks.size(), nOutNacks);
 }
 
-class FaceFailTestFace : public DummyFace
-{
-public:
-  FaceFailTestFace()
-    : failCount(0)
-  {
-    this->onFail.connect(bind(&FaceFailTestFace::failHandler, this, _1));
-  }
-
-  void
-  failOnce()
-  {
-    this->fail("reason");
-  }
-
-private:
-  void
-  failHandler(const std::string& reason)
-  {
-    BOOST_CHECK_EQUAL(reason, "reason");
-    ++this->failCount;
-  }
-
-public:
-  int failCount;
-};
-
-BOOST_AUTO_TEST_CASE(FailTwice)
-{
-  FaceFailTestFace face;
-  BOOST_CHECK_EQUAL(face.failCount, 0);
-  face.failOnce();
-  BOOST_CHECK_EQUAL(face.failCount, 1);
-  face.failOnce();
-  BOOST_CHECK_EQUAL(face.failCount, 1);
-}
-
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestFace
+BOOST_AUTO_TEST_SUITE_END() // Face
 
 } // namespace tests
+} // namespace face
 } // namespace nfd
diff --git a/tests/daemon/face/generic-link-service.t.cpp b/tests/daemon/face/generic-link-service.t.cpp
index 70e078d..888c222 100644
--- a/tests/daemon/face/generic-link-service.t.cpp
+++ b/tests/daemon/face/generic-link-service.t.cpp
@@ -24,7 +24,7 @@
  */
 
 #include "face/generic-link-service.hpp"
-#include "face/lp-face.hpp"
+#include "face/face.hpp"
 #include "dummy-transport.hpp"
 
 #include "tests/test-common.hpp"
@@ -37,6 +37,8 @@
 
 BOOST_AUTO_TEST_SUITE(Face)
 
+using nfd::Face;
+
 class GenericLinkServiceFixture : public BaseFixture
 {
 protected:
@@ -52,8 +54,8 @@
   void
   initialize(const GenericLinkService::Options& options)
   {
-    face.reset(new LpFace(make_unique<GenericLinkService>(options),
-                          make_unique<DummyTransport>()));
+    face.reset(new Face(make_unique<GenericLinkService>(options),
+                        make_unique<DummyTransport>()));
     service = static_cast<GenericLinkService*>(face->getLinkService());
     transport = static_cast<DummyTransport*>(face->getTransport());
 
@@ -66,7 +68,7 @@
   }
 
 protected:
-  unique_ptr<LpFace> face;
+  unique_ptr<Face> face;
   GenericLinkService* service;
   DummyTransport* transport;
   std::vector<Interest> receivedInterests;
diff --git a/tests/daemon/face/internal-face.t.cpp b/tests/daemon/face/internal-face.t.cpp
index cca385e..4371317 100644
--- a/tests/daemon/face/internal-face.t.cpp
+++ b/tests/daemon/face/internal-face.t.cpp
@@ -24,9 +24,8 @@
  */
 
 #include "face/internal-face.hpp"
-#include "face/lp-face-wrapper.hpp"
-#include "transport-test-common.hpp"
 
+#include "transport-test-common.hpp"
 #include "tests/identity-management-fixture.hpp"
 
 namespace nfd {
@@ -43,9 +42,7 @@
 public:
   InternalFaceFixture()
   {
-    std::tie(forwarderFaceW, clientFace) = makeInternalFace(m_keyChain);;
-    forwarderFace = static_pointer_cast<LpFaceWrapper>(forwarderFaceW)->getLpFace();
-    // TODO#3172 eliminate wrapper
+    std::tie(forwarderFace, clientFace) = makeInternalFace(m_keyChain);;
 
     forwarderFace->afterReceiveInterest.connect(
       [this] (const Interest& interest) { receivedInterests.push_back(interest); } );
@@ -56,8 +53,7 @@
   }
 
 protected:
-  shared_ptr<nfd::Face> forwarderFaceW;
-  LpFace* forwarderFace;
+  shared_ptr<nfd::Face> forwarderFace;
   shared_ptr<ndn::Face> clientFace;
 
   std::vector<Interest> receivedInterests;
@@ -199,7 +195,7 @@
   forwarderFace->close();
   this->advanceClocks(time::milliseconds(1), 10);
   BOOST_CHECK_EQUAL(forwarderFace->getState(), FaceState::CLOSED);
-  forwarderFaceW.reset();
+  forwarderFace.reset();
 
   shared_ptr<Interest> interest = makeInterest("/zpHsVesu0B");
   interest->setInterestLifetime(time::milliseconds(100));
diff --git a/tests/daemon/face/lp-face-wrapper.t.cpp b/tests/daemon/face/lp-face-wrapper.t.cpp
deleted file mode 100644
index 8217d77..0000000
--- a/tests/daemon/face/lp-face-wrapper.t.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  Regents of the University of California,
- *                           Arizona Board of Regents,
- *                           Colorado State University,
- *                           University Pierre & Marie Curie, Sorbonne University,
- *                           Washington University in St. Louis,
- *                           Beijing Institute of Technology,
- *                           The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "face/lp-face-wrapper.hpp"
-#include "fw/forwarder.hpp"
-
-#include "tests/test-common.hpp"
-#include "dummy-lp-face.hpp"
-
-namespace nfd {
-namespace face {
-namespace tests {
-
-using namespace nfd::tests;
-
-BOOST_AUTO_TEST_SUITE(Face)
-BOOST_FIXTURE_TEST_SUITE(TestLpFaceWrapper, BaseFixture)
-
-BOOST_AUTO_TEST_CASE(SetId)
-{
-  Forwarder forwarder;
-  auto face1w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>());
-  auto face1 = static_cast<DummyLpFace*>(face1w->getLpFace());
-
-  BOOST_CHECK_EQUAL(face1->getId(), nfd::face::INVALID_FACEID);
-  BOOST_CHECK_EQUAL(face1w->getId(), nfd::INVALID_FACEID);
-
-  forwarder.addFace(face1w);
-
-  BOOST_CHECK_NE(face1->getId(), nfd::face::INVALID_FACEID);
-  BOOST_CHECK_NE(face1w->getId(), nfd::INVALID_FACEID);
-  BOOST_CHECK_EQUAL(face1->getId(), static_cast<face::FaceId>(face1w->getId()));
-}
-
-BOOST_AUTO_TEST_CASE(SetPersistency)
-{
-  unique_ptr<LpFace> face1u = make_unique<DummyLpFace>();
-  face1u->setPersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
-
-  auto face1w = make_shared<face::LpFaceWrapper>(std::move(face1u));
-  auto face1 = static_cast<DummyLpFace*>(face1w->getLpFace());
-
-  BOOST_CHECK_EQUAL(face1->getPersistency(), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
-  BOOST_CHECK_EQUAL(face1w->getPersistency(), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
-
-  face1w->setPersistency(ndn::nfd::FACE_PERSISTENCY_PERMANENT);
-
-  BOOST_CHECK_EQUAL(face1->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERMANENT);
-  BOOST_CHECK_EQUAL(face1w->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERMANENT);
-}
-
-BOOST_AUTO_TEST_CASE(Counters)
-{
-  auto face1w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>());
-  auto face1 = static_cast<DummyLpFace*>(face1w->getLpFace());
-
-  BOOST_CHECK(&face1->getCounters() == &face1w->getCounters());
-}
-
-BOOST_AUTO_TEST_CASE(FailSignal)
-{
-  auto face1w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>());
-  auto face1 = static_cast<DummyLpFace*>(face1w->getLpFace());
-
-  bool isFailed = false;
-  face1w->onFail.connect(bind([&isFailed] { isFailed = true; }));
-
-  face1->setState(FaceState::DOWN);
-  BOOST_CHECK(!isFailed);
-
-  face1->setState(FaceState::FAILED);
-  BOOST_CHECK(!isFailed);
-
-  face1->setState(FaceState::CLOSED);
-  BOOST_CHECK(isFailed);
-}
-
-BOOST_AUTO_TEST_CASE(SendReceive)
-{
-  auto face1w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>());
-  auto face1 = static_cast<DummyLpFace*>(face1w->getLpFace());
-
-  const size_t nInInterests = 192;
-  const size_t nInData = 91;
-  const size_t nInNacks = 29;
-  const size_t nOutInterests = 202;
-  const size_t nOutData = 128;
-  const size_t nOutNacks = 84;
-
-  size_t nReceivedInterests = 0;
-  size_t nReceivedData = 0;
-  size_t nReceivedNacks = 0;
-  face1w->onReceiveInterest.connect(bind([&nReceivedInterests] { ++nReceivedInterests; }));
-  face1w->onReceiveData.connect(bind([&nReceivedData] { ++nReceivedData; }));
-  face1w->onReceiveNack.connect(bind([&nReceivedNacks] { ++nReceivedNacks; }));
-
-  for (size_t i = 0; i < nInInterests; ++i) {
-    shared_ptr<Interest> interest = makeInterest("/JSQdqward4");
-    face1->receiveInterest(*interest);
-  }
-
-  for (size_t i = 0; i < nInData; ++i) {
-    shared_ptr<Data> data = makeData("/hT8FDigWn1");
-    face1->receiveData(*data);
-  }
-
-  for (size_t i = 0; i < nInNacks; ++i) {
-    lp::Nack nack = makeNack("/StnEVTj4Ex", 561, lp::NackReason::CONGESTION);
-    face1->receiveNack(nack);
-  }
-
-  for (size_t i = 0; i < nOutInterests; ++i) {
-    shared_ptr<Interest> interest = makeInterest("/XyUAFYQDmd");
-    face1w->sendInterest(*interest);
-  }
-
-  for (size_t i = 0; i < nOutData; ++i) {
-    shared_ptr<Data> data = makeData("/GigPEtPH6");
-    face1w->sendData(*data);
-  }
-
-  for (size_t i = 0; i < nOutNacks; ++i) {
-    lp::Nack nack = makeNack("/9xK6FbwIBM", 365, lp::NackReason::CONGESTION);
-    face1w->sendNack(nack);
-  }
-
-  BOOST_CHECK_EQUAL(nReceivedInterests, nInInterests);
-  BOOST_CHECK_EQUAL(nReceivedData, nInData);
-  BOOST_CHECK_EQUAL(nReceivedNacks, nInNacks);
-  BOOST_CHECK_EQUAL(face1->sentInterests.size(), nOutInterests);
-  BOOST_CHECK_EQUAL(face1->sentData.size(), nOutData);
-  BOOST_CHECK_EQUAL(face1->sentNacks.size(), nOutNacks);
-}
-
-BOOST_AUTO_TEST_SUITE_END()
-BOOST_AUTO_TEST_SUITE_END()
-
-} // namespace tests
-} // namespace face
-} // namespace nfd
diff --git a/tests/daemon/face/lp-face.t.cpp b/tests/daemon/face/lp-face.t.cpp
deleted file mode 100644
index 92a3755..0000000
--- a/tests/daemon/face/lp-face.t.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  Regents of the University of California,
- *                           Arizona Board of Regents,
- *                           Colorado State University,
- *                           University Pierre & Marie Curie, Sorbonne University,
- *                           Washington University in St. Louis,
- *                           Beijing Institute of Technology,
- *                           The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "face/lp-face.hpp"
-
-#include "tests/test-common.hpp"
-#include "dummy-lp-face.hpp"
-
-namespace nfd {
-namespace face {
-namespace tests {
-
-using namespace nfd::tests;
-
-BOOST_AUTO_TEST_SUITE(Face)
-BOOST_FIXTURE_TEST_SUITE(TestLpFace, BaseFixture)
-
-BOOST_AUTO_TEST_CASE(LinkServiceSendReceive)
-{
-  auto face1 = make_shared<DummyLpFace>();
-
-  const size_t nInInterests = 192;
-  const size_t nInData = 91;
-  const size_t nInNacks = 29;
-  const size_t nOutInterests = 202;
-  const size_t nOutData = 128;
-  const size_t nOutNacks = 84;
-
-  size_t nReceivedInterests = 0;
-  size_t nReceivedData = 0;
-  size_t nReceivedNacks = 0;
-  face1->afterReceiveInterest.connect(bind([&nReceivedInterests] { ++nReceivedInterests; }));
-  face1->afterReceiveData.connect(bind([&nReceivedData] { ++nReceivedData; }));
-  face1->afterReceiveNack.connect(bind([&nReceivedNacks] { ++nReceivedNacks; }));
-
-  for (size_t i = 0; i < nInInterests; ++i) {
-    shared_ptr<Interest> interest = makeInterest("/JSQdqward4");
-    face1->receiveInterest(*interest);
-  }
-
-  for (size_t i = 0; i < nInData; ++i) {
-    shared_ptr<Data> data = makeData("/hT8FDigWn1");
-    face1->receiveData(*data);
-  }
-
-  for (size_t i = 0; i < nInNacks; ++i) {
-    lp::Nack nack = makeNack("/StnEVTj4Ex", 561, lp::NackReason::CONGESTION);
-    face1->receiveNack(nack);
-  }
-
-  for (size_t i = 0; i < nOutInterests; ++i) {
-    shared_ptr<Interest> interest = makeInterest("/XyUAFYQDmd");
-    face1->sendInterest(*interest);
-  }
-
-  for (size_t i = 0; i < nOutData; ++i) {
-    shared_ptr<Data> data = makeData("/GigPEtPH6");
-    face1->sendData(*data);
-  }
-
-  for (size_t i = 0; i < nOutNacks; ++i) {
-    lp::Nack nack = makeNack("/9xK6FbwIBM", 365, lp::NackReason::CONGESTION);
-    face1->sendNack(nack);
-  }
-
-  BOOST_CHECK_EQUAL(face1->getCounters().nInInterests, nInInterests);
-  BOOST_CHECK_EQUAL(face1->getCounters().nInData, nInData);
-  BOOST_CHECK_EQUAL(face1->getCounters().nInNacks, nInNacks);
-  BOOST_CHECK_EQUAL(face1->getCounters().nOutInterests, nOutInterests);
-  BOOST_CHECK_EQUAL(face1->getCounters().nOutData, nOutData);
-  BOOST_CHECK_EQUAL(face1->getCounters().nOutNacks, nOutNacks);
-
-  BOOST_CHECK_EQUAL(nReceivedInterests, nInInterests);
-  BOOST_CHECK_EQUAL(nReceivedData, nInData);
-  BOOST_CHECK_EQUAL(nReceivedNacks, nInNacks);
-  BOOST_CHECK_EQUAL(face1->sentInterests.size(), nOutInterests);
-  BOOST_CHECK_EQUAL(face1->sentData.size(), nOutData);
-  BOOST_CHECK_EQUAL(face1->sentNacks.size(), nOutNacks);
-}
-
-BOOST_AUTO_TEST_SUITE_END()
-BOOST_AUTO_TEST_SUITE_END()
-
-} // namespace tests
-} // namespace face
-} // namespace nfd
diff --git a/tests/daemon/face/null-face.t.cpp b/tests/daemon/face/null-face.t.cpp
index 16d1a11..4075245 100644
--- a/tests/daemon/face/null-face.t.cpp
+++ b/tests/daemon/face/null-face.t.cpp
@@ -24,7 +24,7 @@
  */
 
 #include "face/null-face.hpp"
-#include "face/lp-face-wrapper.hpp"
+
 #include "transport-test-common.hpp"
 
 namespace nfd {
@@ -40,8 +40,7 @@
 
 BOOST_AUTO_TEST_CASE(StaticProperties)
 {
-  shared_ptr<Face> faceW = makeNullFace(FaceUri("testnull://hhppt12sy"));
-  LpFace* face = static_pointer_cast<LpFaceWrapper>(faceW)->getLpFace();
+  shared_ptr<Face> face = makeNullFace(FaceUri("testnull://hhppt12sy"));
   checkStaticPropertiesInitialized(*face->getTransport());
 
   BOOST_CHECK_EQUAL(face->getLocalUri(), FaceUri("testnull://hhppt12sy"));
diff --git a/tests/daemon/face/packet-datasets.cpp b/tests/daemon/face/packet-datasets.cpp
deleted file mode 100644
index 196fa86..0000000
--- a/tests/daemon/face/packet-datasets.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014,  Regents of the University of California,
- *                      Arizona Board of Regents,
- *                      Colorado State University,
- *                      University Pierre & Marie Curie, Sorbonne University,
- *                      Washington University in St. Louis,
- *                      Beijing Institute of Technology,
- *                      The University of Memphis
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "packet-datasets.hpp"
-#include "tests/test-common.hpp"
-
-#include <boost/foreach.hpp>
-
-namespace nfd {
-namespace tests {
-
-BOOST_FIXTURE_TEST_SUITE(Datasets, BaseFixture)
-
-BOOST_AUTO_TEST_CASE(Corrupted)
-{
-  {
-    typedef CorruptedInterest Dataset;
-    Dataset dataset;
-
-    BOOST_FOREACH(Dataset::Container::value_type& data, dataset.data)
-      {
-        Block block(data.buf(), data.size());
-
-        BOOST_CHECK_THROW((Interest(block)), tlv::Error);
-      }
-  }
-}
-
-BOOST_AUTO_TEST_SUITE_END()
-
-} // namespace tests
-} // namespace nfd
diff --git a/tests/daemon/face/packet-datasets.hpp b/tests/daemon/face/packet-datasets.hpp
deleted file mode 100644
index 95639c1..0000000
--- a/tests/daemon/face/packet-datasets.hpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014,  Regents of the University of California,
- *                      Arizona Board of Regents,
- *                      Colorado State University,
- *                      University Pierre & Marie Curie, Sorbonne University,
- *                      Washington University in St. Louis,
- *                      Beijing Institute of Technology,
- *                      The University of Memphis
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NFD_TESTS_DAEMON_FACE_PACKET_DATASETS_HPP
-#define NFD_TESTS_DAEMON_FACE_PACKET_DATASETS_HPP
-
-#include "tests/test-common.hpp"
-
-namespace nfd {
-namespace tests {
-
-class CorruptedInterest
-{
-public:
-  typedef std::vector<ndn::Buffer> Container;
-
-  static std::string
-  getName()
-  {
-    return "CorruptedInterest";
-  }
-
-  CorruptedInterest()
-  {
-    static const uint8_t interest[] = {
-      0x05, 0x1d, 0x07, 0x84, 0x08, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x08, 0x03, 0x6e, 0x64,
-      0x6e, 0x08, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x09, 0x02, 0x12, 0x00, 0x0a, 0x01,
-      0x01
-    };
-
-    data.push_back(ndn::Buffer(interest, sizeof(interest)));
-  }
-public:
-  Container data;
-};
-
-typedef boost::mpl::vector<CorruptedInterest> CorruptedPackets;
-
-} // namespace tests
-} // namespace nfd
-
-#endif // NFD_TESTS_DAEMON_FACE_PACKET_DATASETS_HPP
diff --git a/daemon/face/lp-face.cpp b/tests/daemon/face/tcp-channel.t.cpp
similarity index 67%
rename from daemon/face/lp-face.cpp
rename to tests/daemon/face/tcp-channel.t.cpp
index 55cc4d0..816761d 100644
--- a/daemon/face/lp-face.cpp
+++ b/tests/daemon/face/tcp-channel.t.cpp
@@ -23,24 +23,22 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "lp-face.hpp"
+#include "face/tcp-channel.hpp"
+
+#include "tests/test-common.hpp"
 
 namespace nfd {
-namespace face {
+namespace tests {
 
-LpFace::LpFace(unique_ptr<LinkService> service, unique_ptr<Transport> transport)
-  : afterReceiveInterest(service->afterReceiveInterest)
-  , afterReceiveData(service->afterReceiveData)
-  , afterReceiveNack(service->afterReceiveNack)
-  , afterStateChange(transport->afterStateChange)
-  , m_id(INVALID_FACEID)
-  , m_service(std::move(service))
-  , m_transport(std::move(transport))
-  , m_counters(m_service->getCounters(), m_transport->getCounters())
-{
-  m_service->setFaceAndTransport(*this, *m_transport);
-  m_transport->setFaceAndLinkService(*this, *m_service);
-}
+BOOST_AUTO_TEST_SUITE(Face)
+BOOST_FIXTURE_TEST_SUITE(TestTcpChannel, BaseFixture)
 
-} // namespace face
+// TODO add the equivalent of these test cases from tcp.t.cpp as of commit:65caf200924b28748037750449e28bcb548dbc9c
+// MultipleAccepts
+// FaceClosing
+
+BOOST_AUTO_TEST_SUITE_END() // TestTcpChannel
+BOOST_AUTO_TEST_SUITE_END() // Face
+
+} // namespace tests
 } // namespace nfd
diff --git a/tests/daemon/face/tcp-factory.t.cpp b/tests/daemon/face/tcp-factory.t.cpp
new file mode 100644
index 0000000..ee796ab
--- /dev/null
+++ b/tests/daemon/face/tcp-factory.t.cpp
@@ -0,0 +1,258 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "face/tcp-factory.hpp"
+
+#include "core/network-interface.hpp"
+#include "tests/test-common.hpp"
+#include "tests/limited-io.hpp"
+
+namespace nfd {
+namespace tests {
+
+BOOST_AUTO_TEST_SUITE(Face)
+BOOST_FIXTURE_TEST_SUITE(TestTcpFactory, BaseFixture)
+
+using nfd::Face;
+
+BOOST_AUTO_TEST_CASE(ChannelMap)
+{
+  TcpFactory factory;
+
+  shared_ptr<TcpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
+  shared_ptr<TcpChannel> channel1a = factory.createChannel("127.0.0.1", "20070");
+  BOOST_CHECK_EQUAL(channel1, channel1a);
+  BOOST_CHECK_EQUAL(channel1->getUri().toString(), "tcp4://127.0.0.1:20070");
+
+  shared_ptr<TcpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
+  BOOST_CHECK_NE(channel1, channel2);
+
+  shared_ptr<TcpChannel> channel3 = factory.createChannel("::1", "20071");
+  BOOST_CHECK_NE(channel2, channel3);
+  BOOST_CHECK_EQUAL(channel3->getUri().toString(), "tcp6://[::1]:20071");
+}
+
+BOOST_AUTO_TEST_CASE(GetChannels)
+{
+  TcpFactory factory;
+  BOOST_REQUIRE_EQUAL(factory.getChannels().empty(), true);
+
+  std::vector<shared_ptr<const Channel>> expectedChannels;
+  expectedChannels.push_back(factory.createChannel("127.0.0.1", "20070"));
+  expectedChannels.push_back(factory.createChannel("127.0.0.1", "20071"));
+  expectedChannels.push_back(factory.createChannel("::1", "20071"));
+
+  for (const auto& ch : factory.getChannels()) {
+    auto pos = std::find(expectedChannels.begin(), expectedChannels.end(), ch);
+    BOOST_REQUIRE(pos != expectedChannels.end());
+    expectedChannels.erase(pos);
+  }
+  BOOST_CHECK_EQUAL(expectedChannels.size(), 0);
+}
+
+class FaceCreateFixture : public BaseFixture
+{
+public:
+  void
+  checkError(const std::string& errorActual, const std::string& errorExpected)
+  {
+    BOOST_CHECK_EQUAL(errorActual, errorExpected);
+  }
+
+  void
+  failIfError(const std::string& errorActual)
+  {
+    BOOST_FAIL("No error expected, but got: [" << errorActual << "]");
+  }
+};
+
+BOOST_FIXTURE_TEST_CASE(FaceCreate, FaceCreateFixture)
+{
+  TcpFactory factory;
+
+  factory.createFace(FaceUri("tcp4://127.0.0.1:6363"),
+                     ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+                     bind([]{}),
+                     bind(&FaceCreateFixture::checkError, this, _1,
+                          "No channels available to connect to 127.0.0.1:6363"));
+
+  factory.createChannel("127.0.0.1", "20071");
+
+  factory.createFace(FaceUri("tcp4://127.0.0.1:20070"),
+                     ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+                     bind([]{}),
+                     bind(&FaceCreateFixture::failIfError, this, _1));
+}
+
+BOOST_AUTO_TEST_CASE(UnsupportedFaceCreate)
+{
+  TcpFactory factory;
+
+  factory.createChannel("127.0.0.1", "20070");
+  factory.createChannel("127.0.0.1", "20071");
+
+  BOOST_CHECK_THROW(factory.createFace(FaceUri("tcp4://127.0.0.1:20070"),
+                                       ndn::nfd::FACE_PERSISTENCY_PERMANENT,
+                                       bind([]{}),
+                                       bind([]{})),
+                    ProtocolFactory::Error);
+
+  BOOST_CHECK_THROW(factory.createFace(FaceUri("tcp4://127.0.0.1:20071"),
+                                       ndn::nfd::FACE_PERSISTENCY_ON_DEMAND,
+                                       bind([]{}),
+                                       bind([]{})),
+                    ProtocolFactory::Error);
+}
+
+class FaceCreateTimeoutFixture : public BaseFixture
+{
+public:
+  void
+  onFaceCreated(const shared_ptr<Face>& newFace)
+  {
+    BOOST_CHECK_MESSAGE(false, "Timeout expected");
+    BOOST_CHECK(!static_cast<bool>(face1));
+    face1 = newFace;
+
+    limitedIo.afterOp();
+  }
+
+  void
+  onConnectFailed(const std::string& reason)
+  {
+    BOOST_CHECK_MESSAGE(true, reason);
+
+    limitedIo.afterOp();
+  }
+
+public:
+  LimitedIo limitedIo;
+
+  shared_ptr<Face> face1;
+};
+
+BOOST_FIXTURE_TEST_CASE(FaceCreateTimeout, FaceCreateTimeoutFixture)
+{
+  TcpFactory factory;
+  shared_ptr<TcpChannel> channel = factory.createChannel("0.0.0.0", "20070");
+
+  factory.createFace(FaceUri("tcp4://192.0.2.1:20070"),
+                     ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+                     bind(&FaceCreateTimeoutFixture::onFaceCreated, this, _1),
+                     bind(&FaceCreateTimeoutFixture::onConnectFailed, this, _1));
+
+  BOOST_CHECK_MESSAGE(limitedIo.run(1, time::seconds(10)) == LimitedIo::EXCEED_OPS,
+                      "TcpChannel error: cannot connect or cannot accept connection");
+
+  BOOST_CHECK_EQUAL(static_cast<bool>(face1), false);
+}
+
+class FakeNetworkInterfaceFixture : public BaseFixture
+{
+public:
+  FakeNetworkInterfaceFixture()
+  {
+    using namespace boost::asio::ip;
+
+    auto fakeInterfaces = make_shared<std::vector<NetworkInterfaceInfo>>();
+
+    fakeInterfaces->push_back(
+      NetworkInterfaceInfo {0, "eth0",
+        ethernet::Address::fromString("3e:15:c2:8b:65:00"),
+        {address_v4::from_string("0.0.0.0")},
+        {address_v6::from_string("::")},
+        address_v4(),
+        IFF_UP});
+    fakeInterfaces->push_back(
+      NetworkInterfaceInfo {1, "eth0",
+        ethernet::Address::fromString("3e:15:c2:8b:65:00"),
+        {address_v4::from_string("192.168.2.1"), address_v4::from_string("192.168.2.2")},
+        {},
+        address_v4::from_string("192.168.2.255"),
+        0});
+    fakeInterfaces->push_back(
+      NetworkInterfaceInfo {2, "eth1",
+        ethernet::Address::fromString("3e:15:c2:8b:65:00"),
+        {address_v4::from_string("198.51.100.1")},
+        {address_v6::from_string("2001:db8::2"), address_v6::from_string("2001:db8::3")},
+        address_v4::from_string("198.51.100.255"),
+        IFF_MULTICAST | IFF_BROADCAST | IFF_UP});
+
+    setDebugNetworkInterfaces(fakeInterfaces);
+  }
+
+  ~FakeNetworkInterfaceFixture()
+  {
+    setDebugNetworkInterfaces(nullptr);
+  }
+};
+
+BOOST_FIXTURE_TEST_CASE(Bug2292, FakeNetworkInterfaceFixture)
+{
+  using namespace boost::asio::ip;
+
+  TcpFactory factory;
+  factory.prohibitEndpoint(tcp::Endpoint(address_v4::from_string("192.168.2.1"), 1024));
+  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 1);
+  BOOST_CHECK((factory.m_prohibitedEndpoints ==
+               std::set<tcp::Endpoint> {
+                 tcp::Endpoint(address_v4::from_string("192.168.2.1"), 1024),
+               }));
+
+  factory.m_prohibitedEndpoints.clear();
+  factory.prohibitEndpoint(tcp::Endpoint(address_v6::from_string("2001:db8::1"), 2048));
+  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 1);
+  BOOST_CHECK((factory.m_prohibitedEndpoints ==
+               std::set<tcp::Endpoint> {
+                 tcp::Endpoint(address_v6::from_string("2001:db8::1"), 2048)
+               }));
+
+  factory.m_prohibitedEndpoints.clear();
+  factory.prohibitEndpoint(tcp::Endpoint(address_v4(), 1024));
+  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 4);
+  BOOST_CHECK((factory.m_prohibitedEndpoints ==
+               std::set<tcp::Endpoint> {
+                 tcp::Endpoint(address_v4::from_string("192.168.2.1"), 1024),
+                 tcp::Endpoint(address_v4::from_string("192.168.2.2"), 1024),
+                 tcp::Endpoint(address_v4::from_string("198.51.100.1"), 1024),
+                 tcp::Endpoint(address_v4::from_string("0.0.0.0"), 1024)
+               }));
+
+  factory.m_prohibitedEndpoints.clear();
+  factory.prohibitEndpoint(tcp::Endpoint(address_v6(), 2048));
+  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 3);
+  BOOST_CHECK((factory.m_prohibitedEndpoints ==
+               std::set<tcp::Endpoint> {
+                 tcp::Endpoint(address_v6::from_string("2001:db8::2"), 2048),
+                 tcp::Endpoint(address_v6::from_string("2001:db8::3"), 2048),
+                 tcp::Endpoint(address_v6::from_string("::"), 2048)
+               }));
+}
+
+BOOST_AUTO_TEST_SUITE_END() // TestTcpFactory
+BOOST_AUTO_TEST_SUITE_END() // Face
+
+} // namespace tests
+} // namespace nfd
diff --git a/tests/daemon/face/tcp-transport-fixture.hpp b/tests/daemon/face/tcp-transport-fixture.hpp
index 38be67b..e68eff9 100644
--- a/tests/daemon/face/tcp-transport-fixture.hpp
+++ b/tests/daemon/face/tcp-transport-fixture.hpp
@@ -27,7 +27,7 @@
 #define NFD_TESTS_DAEMON_FACE_TCP_TRANSPORT_FIXTURE_HPP
 
 #include "face/tcp-transport.hpp"
-#include "face/lp-face.hpp"
+#include "face/face.hpp"
 
 #include "dummy-receive-link-service.hpp"
 #include "tests/limited-io.hpp"
@@ -73,9 +73,9 @@
     BOOST_REQUIRE_EQUAL(limitedIo.run(2, time::seconds(1)), LimitedIo::EXCEED_OPS);
 
     localEp = sock.local_endpoint();
-    face = make_unique<LpFace>(make_unique<DummyReceiveLinkService>(),
-                               make_unique<TcpTransport>(std::move(sock),
-                                                         ndn::nfd::FACE_PERSISTENCY_PERSISTENT));
+    face = make_unique<Face>(make_unique<DummyReceiveLinkService>(),
+                             make_unique<TcpTransport>(std::move(sock),
+                                                       ndn::nfd::FACE_PERSISTENCY_PERSISTENT));
     transport = static_cast<TcpTransport*>(face->getTransport());
     receivedPackets = &static_cast<DummyReceiveLinkService*>(face->getLinkService())->receivedPackets;
 
@@ -103,7 +103,7 @@
 
 private:
   tcp::acceptor acceptor;
-  unique_ptr<LpFace> face;
+  unique_ptr<Face> face;
 };
 
 } // namespace tests
diff --git a/tests/daemon/face/tcp.t.cpp b/tests/daemon/face/tcp.t.cpp
deleted file mode 100644
index 6d5fe19..0000000
--- a/tests/daemon/face/tcp.t.cpp
+++ /dev/null
@@ -1,758 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  Regents of the University of California,
- *                           Arizona Board of Regents,
- *                           Colorado State University,
- *                           University Pierre & Marie Curie, Sorbonne University,
- *                           Washington University in St. Louis,
- *                           Beijing Institute of Technology,
- *                           The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "face/tcp-channel.hpp"
-#include "face/tcp-factory.hpp"
-
-#include "core/network-interface.hpp"
-#include "tests/test-common.hpp"
-#include "tests/limited-io.hpp"
-#include "dummy-stream-sender.hpp"
-#include "packet-datasets.hpp"
-
-namespace nfd {
-namespace tests {
-
-BOOST_AUTO_TEST_SUITE(Face)
-BOOST_FIXTURE_TEST_SUITE(TestTcp, BaseFixture)
-
-using nfd::Face;
-
-BOOST_AUTO_TEST_CASE(ChannelMap)
-{
-  TcpFactory factory;
-
-  shared_ptr<TcpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
-  shared_ptr<TcpChannel> channel1a = factory.createChannel("127.0.0.1", "20070");
-  BOOST_CHECK_EQUAL(channel1, channel1a);
-  BOOST_CHECK_EQUAL(channel1->getUri().toString(), "tcp4://127.0.0.1:20070");
-
-  shared_ptr<TcpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
-  BOOST_CHECK_NE(channel1, channel2);
-
-  shared_ptr<TcpChannel> channel3 = factory.createChannel("::1", "20071");
-  BOOST_CHECK_NE(channel2, channel3);
-  BOOST_CHECK_EQUAL(channel3->getUri().toString(), "tcp6://[::1]:20071");
-}
-
-BOOST_AUTO_TEST_CASE(GetChannels)
-{
-  TcpFactory factory;
-  BOOST_REQUIRE_EQUAL(factory.getChannels().empty(), true);
-
-  std::vector<shared_ptr<const Channel>> expectedChannels;
-  expectedChannels.push_back(factory.createChannel("127.0.0.1", "20070"));
-  expectedChannels.push_back(factory.createChannel("127.0.0.1", "20071"));
-  expectedChannels.push_back(factory.createChannel("::1", "20071"));
-
-  for (const auto& ch : factory.getChannels()) {
-    auto pos = std::find(expectedChannels.begin(), expectedChannels.end(), ch);
-    BOOST_REQUIRE(pos != expectedChannels.end());
-    expectedChannels.erase(pos);
-  }
-  BOOST_CHECK_EQUAL(expectedChannels.size(), 0);
-}
-
-class FaceCreateFixture : protected BaseFixture
-{
-public:
-  void
-  checkError(const std::string& errorActual, const std::string& errorExpected)
-  {
-    BOOST_CHECK_EQUAL(errorActual, errorExpected);
-  }
-
-  void
-  failIfError(const std::string& errorActual)
-  {
-    BOOST_FAIL("No error expected, but got: [" << errorActual << "]");
-  }
-};
-
-BOOST_FIXTURE_TEST_CASE(FaceCreate, FaceCreateFixture)
-{
-  TcpFactory factory;
-
-  factory.createFace(FaceUri("tcp4://127.0.0.1:6363"),
-                     ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-                     bind([]{}),
-                     bind(&FaceCreateFixture::checkError, this, _1,
-                          "No channels available to connect to 127.0.0.1:6363"));
-
-  factory.createChannel("127.0.0.1", "20071");
-
-  factory.createFace(FaceUri("tcp4://127.0.0.1:20070"),
-                     ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-                     bind([]{}),
-                     bind(&FaceCreateFixture::failIfError, this, _1));
-}
-
-BOOST_AUTO_TEST_CASE(UnsupportedFaceCreate)
-{
-  TcpFactory factory;
-
-  factory.createChannel("127.0.0.1", "20070");
-  factory.createChannel("127.0.0.1", "20071");
-
-  BOOST_CHECK_THROW(factory.createFace(FaceUri("tcp4://127.0.0.1:20070"),
-                                       ndn::nfd::FACE_PERSISTENCY_PERMANENT,
-                                       bind([]{}),
-                                       bind([]{})),
-                    ProtocolFactory::Error);
-
-  BOOST_CHECK_THROW(factory.createFace(FaceUri("tcp4://127.0.0.1:20071"),
-                                       ndn::nfd::FACE_PERSISTENCY_ON_DEMAND,
-                                       bind([]{}),
-                                       bind([]{})),
-                    ProtocolFactory::Error);
-}
-
-class EndToEndFixture : protected BaseFixture
-{
-public:
-  void
-  channel1_onFaceCreated(const shared_ptr<Face>& newFace)
-  {
-    BOOST_CHECK(!static_cast<bool>(face1));
-    face1 = newFace;
-    face1->onReceiveInterest.connect(bind(&EndToEndFixture::face1_onReceiveInterest, this, _1));
-    face1->onReceiveData.connect(bind(&EndToEndFixture::face1_onReceiveData, this, _1));
-    face1->onFail.connect(bind(&EndToEndFixture::face1_onFail, this));
-
-    limitedIo.afterOp();
-  }
-
-  void
-  channel1_onConnectFailed(const std::string& reason)
-  {
-    BOOST_CHECK_MESSAGE(false, reason);
-
-    limitedIo.afterOp();
-  }
-
-  void
-  face1_onReceiveInterest(const Interest& interest)
-  {
-    face1_receivedInterests.push_back(interest);
-
-    limitedIo.afterOp();
-  }
-
-  void
-  face1_onReceiveData(const Data& data)
-  {
-    face1_receivedDatas.push_back(data);
-
-    limitedIo.afterOp();
-  }
-
-  void
-  face1_onFail()
-  {
-    g_io.post([this] {
-      face1.reset();
-      limitedIo.afterOp();
-    });
-  }
-
-  void
-  channel2_onFaceCreated(const shared_ptr<Face>& newFace)
-  {
-    BOOST_CHECK(!static_cast<bool>(face2));
-    face2 = newFace;
-    face2->onReceiveInterest.connect(bind(&EndToEndFixture::face2_onReceiveInterest, this, _1));
-    face2->onReceiveData.connect(bind(&EndToEndFixture::face2_onReceiveData, this, _1));
-    face2->onFail.connect(bind(&EndToEndFixture::face2_onFail, this));
-
-    limitedIo.afterOp();
-  }
-
-  void
-  channel2_onConnectFailed(const std::string& reason)
-  {
-    BOOST_CHECK_MESSAGE(false, reason);
-
-    limitedIo.afterOp();
-  }
-
-  void
-  face2_onReceiveInterest(const Interest& interest)
-  {
-    face2_receivedInterests.push_back(interest);
-
-    limitedIo.afterOp();
-  }
-
-  void
-  face2_onReceiveData(const Data& data)
-  {
-    face2_receivedDatas.push_back(data);
-
-    limitedIo.afterOp();
-  }
-
-  void
-  face2_onFail()
-  {
-    g_io.post([this] {
-      face2.reset();
-      limitedIo.afterOp();
-    });
-  }
-
-  void
-  channel_onFaceCreated(const shared_ptr<Face>& newFace)
-  {
-    faces.push_back(newFace);
-    limitedIo.afterOp();
-  }
-
-  void
-  channel_onConnectFailed(const std::string& reason)
-  {
-    BOOST_CHECK_MESSAGE(false, reason);
-
-    limitedIo.afterOp();
-  }
-
-  void
-  checkFaceList(size_t shouldBe)
-  {
-    BOOST_CHECK_EQUAL(faces.size(), shouldBe);
-  }
-
-  void
-  connect(const shared_ptr<TcpChannel>& channel,
-          const std::string& remoteHost,
-          const std::string& remotePort)
-  {
-    channel->connect(tcp::Endpoint(boost::asio::ip::address::from_string(remoteHost),
-                                   boost::lexical_cast<uint16_t>(remotePort)),
-                     bind(&EndToEndFixture::channel_onFaceCreated, this, _1),
-                     bind(&EndToEndFixture::channel_onConnectFailed, this, _1));
-  }
-
-public:
-  LimitedIo limitedIo;
-
-  shared_ptr<Face> face1;
-  std::vector<Interest> face1_receivedInterests;
-  std::vector<Data> face1_receivedDatas;
-  shared_ptr<Face> face2;
-  std::vector<Interest> face2_receivedInterests;
-  std::vector<Data> face2_receivedDatas;
-
-  std::list<shared_ptr<Face>> faces;
-};
-
-BOOST_FIXTURE_TEST_CASE(EndToEnd4, EndToEndFixture)
-{
-  TcpFactory factory1;
-
-  shared_ptr<TcpChannel> channel1 = factory1.createChannel("127.0.0.1", "20070");
-  factory1.createChannel("127.0.0.1", "20071");
-
-  BOOST_CHECK_EQUAL(channel1->isListening(), false);
-
-  channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated,   this, _1),
-                   bind(&EndToEndFixture::channel1_onConnectFailed, this, _1));
-
-  BOOST_CHECK_EQUAL(channel1->isListening(), true);
-
-  TcpFactory factory2;
-
-  shared_ptr<TcpChannel> channel2 = factory2.createChannel("127.0.0.2", "20070");
-  factory2.createChannel("127.0.0.2", "20071");
-
-  factory2.createFace(FaceUri("tcp4://127.0.0.1:20070"),
-                      ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-                      bind(&EndToEndFixture::channel2_onFaceCreated, this, _1),
-                      bind(&EndToEndFixture::channel2_onConnectFailed, this, _1));
-
-  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
-                      "TcpChannel error: cannot connect or cannot accept connection");
-
-  BOOST_REQUIRE(static_cast<bool>(face1));
-  BOOST_REQUIRE(static_cast<bool>(face2));
-
-  BOOST_CHECK_EQUAL(face1->getPersistency(), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
-  BOOST_CHECK_EQUAL(face2->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
-  BOOST_CHECK_EQUAL(face1->isMultiAccess(), false);
-  BOOST_CHECK_EQUAL(face2->isMultiAccess(), false);
-
-  BOOST_CHECK_EQUAL(face2->getRemoteUri().toString(), "tcp4://127.0.0.1:20070");
-  BOOST_CHECK_EQUAL(face1->getLocalUri().toString(), "tcp4://127.0.0.1:20070");
-  // face1 has an unknown remoteUri, since the source port is automatically chosen by OS
-
-  BOOST_CHECK_EQUAL(face1->isLocal(), true);
-  BOOST_CHECK_EQUAL(face2->isLocal(), true);
-
-  shared_ptr<Interest> interest1 = makeInterest("ndn:/TpnzGvW9R");
-  shared_ptr<Data>     data1     = makeData("ndn:/KfczhUqVix");
-  shared_ptr<Interest> interest2 = makeInterest("ndn:/QWiIMfj5sL");
-  shared_ptr<Data>     data2     = makeData("ndn:/XNBV796f");
-
-  face1->sendInterest(*interest1);
-  face1->sendInterest(*interest1);
-  face1->sendInterest(*interest1);
-  face1->sendData    (*data1    );
-  size_t nBytesSent1 = interest1->wireEncode().size() * 3 + data1->wireEncode().size();
-  face2->sendInterest(*interest2);
-  face2->sendData    (*data2    );
-  face2->sendData    (*data2    );
-  face2->sendData    (*data2    );
-
-  BOOST_CHECK_MESSAGE(limitedIo.run(8, time::seconds(10)) == LimitedIo::EXCEED_OPS,
-                      "TcpChannel error: cannot send or receive Interest/Data packets");
-
-  BOOST_REQUIRE_EQUAL(face1_receivedInterests.size(), 1);
-  BOOST_REQUIRE_EQUAL(face1_receivedDatas    .size(), 3);
-  BOOST_REQUIRE_EQUAL(face2_receivedInterests.size(), 3);
-  BOOST_REQUIRE_EQUAL(face2_receivedDatas    .size(), 1);
-
-  BOOST_CHECK_EQUAL(face1_receivedInterests[0].getName(), interest2->getName());
-  BOOST_CHECK_EQUAL(face1_receivedDatas    [0].getName(), data2->getName());
-  BOOST_CHECK_EQUAL(face2_receivedInterests[0].getName(), interest1->getName());
-  BOOST_CHECK_EQUAL(face2_receivedDatas    [0].getName(), data1->getName());
-
-  // needed to ensure NOutBytes counters are accurate
-  limitedIo.run(LimitedIo::UNLIMITED_OPS, time::seconds(1));
-
-  const face::FaceCounters& counters1 = face1->getCounters();
-  BOOST_CHECK_EQUAL(counters1.nInInterests, 1);
-  BOOST_CHECK_EQUAL(counters1.nInData, 3);
-  BOOST_CHECK_EQUAL(counters1.nOutInterests, 3);
-  BOOST_CHECK_EQUAL(counters1.nOutData, 1);
-  BOOST_CHECK_EQUAL(counters1.nOutBytes, nBytesSent1);
-
-  const face::FaceCounters& counters2 = face2->getCounters();
-  BOOST_CHECK_EQUAL(counters2.nInInterests, 3);
-  BOOST_CHECK_EQUAL(counters2.nInData, 1);
-  BOOST_CHECK_EQUAL(counters2.nOutInterests, 1);
-  BOOST_CHECK_EQUAL(counters2.nOutData, 3);
-  BOOST_CHECK_EQUAL(counters2.nInBytes, nBytesSent1);
-}
-
-BOOST_FIXTURE_TEST_CASE(EndToEnd6, EndToEndFixture)
-{
-  TcpFactory factory1;
-
-  shared_ptr<TcpChannel> channel1 = factory1.createChannel("::1", "20070");
-  shared_ptr<TcpChannel> channel2 = factory1.createChannel("::1", "20071");
-
-  channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated,   this, _1),
-                   bind(&EndToEndFixture::channel1_onConnectFailed, this, _1));
-
-  TcpFactory factory2;
-
-  factory2.createChannel("::2", "20070");
-
-  factory2.createFace(FaceUri("tcp6://[::1]:20070"),
-                      ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-                      bind(&EndToEndFixture::channel2_onFaceCreated, this, _1),
-                      bind(&EndToEndFixture::channel2_onConnectFailed, this, _1));
-
-  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
-                      "TcpChannel error: cannot connect or cannot accept connection");
-
-  BOOST_REQUIRE(static_cast<bool>(face1));
-  BOOST_REQUIRE(static_cast<bool>(face2));
-
-  BOOST_CHECK_EQUAL(face2->getRemoteUri().toString(), "tcp6://[::1]:20070");
-  BOOST_CHECK_EQUAL(face1->getLocalUri().toString(), "tcp6://[::1]:20070");
-  // face1 has an unknown remoteUri, since the source port is automatically chosen by OS
-
-  BOOST_CHECK_EQUAL(face1->isLocal(), true);
-  BOOST_CHECK_EQUAL(face2->isLocal(), true);
-
-  shared_ptr<Interest> interest1 = makeInterest("ndn:/TpnzGvW9R");
-  shared_ptr<Data>     data1     = makeData("ndn:/KfczhUqVix");
-  shared_ptr<Interest> interest2 = makeInterest("ndn:/QWiIMfj5sL");
-  shared_ptr<Data>     data2     = makeData("ndn:/XNBV796f");
-
-  face1->sendInterest(*interest1);
-  face1->sendData    (*data1    );
-  face2->sendInterest(*interest2);
-  face2->sendData    (*data2    );
-
-  BOOST_CHECK_MESSAGE(limitedIo.run(4, time::seconds(10)) == LimitedIo::EXCEED_OPS,
-                      "TcpChannel error: cannot send or receive Interest/Data packets");
-
-
-  BOOST_REQUIRE_EQUAL(face1_receivedInterests.size(), 1);
-  BOOST_REQUIRE_EQUAL(face1_receivedDatas    .size(), 1);
-  BOOST_REQUIRE_EQUAL(face2_receivedInterests.size(), 1);
-  BOOST_REQUIRE_EQUAL(face2_receivedDatas    .size(), 1);
-
-  BOOST_CHECK_EQUAL(face1_receivedInterests[0].getName(), interest2->getName());
-  BOOST_CHECK_EQUAL(face1_receivedDatas    [0].getName(), data2->getName());
-  BOOST_CHECK_EQUAL(face2_receivedInterests[0].getName(), interest1->getName());
-  BOOST_CHECK_EQUAL(face2_receivedDatas    [0].getName(), data1->getName());
-}
-
-BOOST_FIXTURE_TEST_CASE(MultipleAccepts, EndToEndFixture)
-{
-  TcpFactory factory;
-
-  shared_ptr<TcpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
-  shared_ptr<TcpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
-
-  channel1->listen(bind(&EndToEndFixture::channel_onFaceCreated,   this, _1),
-                   bind(&EndToEndFixture::channel_onConnectFailed, this, _1));
-
-  using namespace boost::asio;
-  channel2->connect(tcp::Endpoint(ip::address::from_string("127.0.0.1"), 20070),
-                    bind(&EndToEndFixture::channel_onFaceCreated, this, _1),
-                    bind(&EndToEndFixture::channel_onConnectFailed, this, _1),
-                    time::seconds(4)); // very short timeout
-
-  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
-                      "TcpChannel error: cannot connect or cannot accept connection");
-
-
-  BOOST_CHECK_EQUAL(faces.size(), 2);
-
-  shared_ptr<TcpChannel> channel3 = factory.createChannel("127.0.0.1", "20072");
-  channel3->connect(tcp::Endpoint(ip::address::from_string("127.0.0.1"), 20070),
-                    bind(&EndToEndFixture::channel_onFaceCreated, this, _1),
-                    bind(&EndToEndFixture::channel_onConnectFailed, this, _1),
-                    time::seconds(4)); // very short timeout
-
-
-  shared_ptr<TcpChannel> channel4 = factory.createChannel("127.0.0.1", "20073");
-
-  BOOST_CHECK_NE(channel3, channel4);
-
-  scheduler::schedule(time::seconds(1),
-                      bind(&EndToEndFixture::connect, this, channel4, "127.0.0.1", "20070"));
-
-  scheduler::schedule(time::milliseconds(500),
-                      bind(&EndToEndFixture::checkFaceList, this, 4));
-
-  BOOST_CHECK_MESSAGE(limitedIo.run(4,// 2 connects and 2 accepts
-                      time::seconds(10)) == LimitedIo::EXCEED_OPS,
-                      "TcpChannel error: cannot connect or cannot accept multiple connections");
-
-  BOOST_CHECK_EQUAL(faces.size(), 6);
-}
-
-BOOST_FIXTURE_TEST_CASE(FaceClosing, EndToEndFixture)
-{
-  TcpFactory factory;
-
-  shared_ptr<TcpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
-  shared_ptr<TcpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
-
-  channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated,   this, _1),
-                   bind(&EndToEndFixture::channel1_onConnectFailed, this, _1));
-
-  using namespace boost::asio;
-  channel2->connect(tcp::Endpoint(ip::address::from_string("127.0.0.1"), 20070),
-                    bind(&EndToEndFixture::channel2_onFaceCreated, this, _1),
-                    bind(&EndToEndFixture::channel2_onConnectFailed, this, _1),
-                    time::seconds(4)); // very short timeout
-
-  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
-                      "TcpChannel error: cannot connect or cannot accept connection");
-
-  BOOST_CHECK_EQUAL(channel1->size(), 1);
-  BOOST_CHECK_EQUAL(channel2->size(), 1);
-
-  BOOST_REQUIRE(static_cast<bool>(face1));
-  BOOST_CHECK(static_cast<bool>(face2));
-
-  // Face::close must be invoked during io run to be counted as an op
-  scheduler::schedule(time::milliseconds(100), bind(&Face::close, face1));
-
-  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
-                      "FaceClosing error: cannot properly close faces");
-
-  // both faces should get closed
-  BOOST_CHECK(!static_cast<bool>(face1));
-  BOOST_CHECK(!static_cast<bool>(face2));
-
-  BOOST_CHECK_EQUAL(channel1->size(), 0);
-  BOOST_CHECK_EQUAL(channel2->size(), 0);
-}
-
-class SimpleEndToEndFixture : protected BaseFixture
-{
-public:
-  void
-  onFaceCreated(const shared_ptr<Face>& face)
-  {
-    face->onReceiveInterest.connect(bind(&SimpleEndToEndFixture::onReceiveInterest, this, _1));
-    face->onReceiveData.connect(bind(&SimpleEndToEndFixture::onReceiveData, this, _1));
-    face->onFail.connect(bind(&SimpleEndToEndFixture::onFail, this, face));
-
-    limitedIo.afterOp();
-  }
-
-  void
-  onConnectFailed(const std::string& reason)
-  {
-    BOOST_CHECK_MESSAGE(false, reason);
-
-    limitedIo.afterOp();
-  }
-
-  void
-  onReceiveInterest(const Interest& interest)
-  {
-    receivedInterests.push_back(interest);
-
-    limitedIo.afterOp();
-  }
-
-  void
-  onReceiveData(const Data& data)
-  {
-    receivedDatas.push_back(data);
-
-    limitedIo.afterOp();
-  }
-
-  void
-  onFail(const shared_ptr<Face>& face)
-  {
-    limitedIo.afterOp();
-  }
-
-public:
-  LimitedIo limitedIo;
-
-  std::vector<Interest> receivedInterests;
-  std::vector<Data> receivedDatas;
-};
-
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(FaceCorruptedInput, Dataset,
-                                 CorruptedPackets, SimpleEndToEndFixture)
-{
-  // test with non-local Face
-  boost::asio::ip::address_v4 someIpv4Address;
-  for (const auto& netif : listNetworkInterfaces()) {
-    if (!netif.isLoopback() && netif.isUp() && !netif.ipv4Addresses.empty()) {
-      someIpv4Address = netif.ipv4Addresses.front();
-      break;
-    }
-  }
-  if (someIpv4Address.is_unspecified()) {
-    BOOST_TEST_MESSAGE("Test with non-local Face cannot be run "
-                       "(no non-loopback interface with IPv4 address found)");
-    return;
-  }
-
-  TcpFactory factory;
-  tcp::Endpoint endpoint(someIpv4Address, 20070);
-
-  shared_ptr<TcpChannel> channel = factory.createChannel(endpoint);
-  channel->listen(bind(&SimpleEndToEndFixture::onFaceCreated,   this, _1),
-                  bind(&SimpleEndToEndFixture::onConnectFailed, this, _1));
-  BOOST_REQUIRE_EQUAL(channel->isListening(), true);
-
-  DummyStreamSender<boost::asio::ip::tcp, Dataset> sender;
-  sender.start(endpoint);
-
-  BOOST_CHECK_MESSAGE(limitedIo.run(LimitedIo::UNLIMITED_OPS,
-                                    time::seconds(1)) == LimitedIo::EXCEED_TIME,
-                      "Exception thrown for " + Dataset::getName());
-}
-
-class FaceCreateTimeoutFixture : protected BaseFixture
-{
-public:
-  void
-  onFaceCreated(const shared_ptr<Face>& newFace)
-  {
-    BOOST_CHECK_MESSAGE(false, "Timeout expected");
-    BOOST_CHECK(!static_cast<bool>(face1));
-    face1 = newFace;
-
-    limitedIo.afterOp();
-  }
-
-  void
-  onConnectFailed(const std::string& reason)
-  {
-    BOOST_CHECK_MESSAGE(true, reason);
-
-    limitedIo.afterOp();
-  }
-
-public:
-  LimitedIo limitedIo;
-
-  shared_ptr<Face> face1;
-};
-
-BOOST_FIXTURE_TEST_CASE(FaceCreateTimeout, FaceCreateTimeoutFixture)
-{
-  TcpFactory factory;
-  shared_ptr<TcpChannel> channel = factory.createChannel("0.0.0.0", "20070");
-
-  factory.createFace(FaceUri("tcp4://192.0.2.1:20070"),
-                     ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-                     bind(&FaceCreateTimeoutFixture::onFaceCreated, this, _1),
-                     bind(&FaceCreateTimeoutFixture::onConnectFailed, this, _1));
-
-  BOOST_CHECK_MESSAGE(limitedIo.run(1, time::seconds(10)) == LimitedIo::EXCEED_OPS,
-                      "TcpChannel error: cannot connect or cannot accept connection");
-
-  BOOST_CHECK_EQUAL(static_cast<bool>(face1), false);
-}
-
-BOOST_FIXTURE_TEST_CASE(Bug1856, EndToEndFixture)
-{
-  TcpFactory factory1;
-
-  shared_ptr<TcpChannel> channel1 = factory1.createChannel("127.0.0.1", "20070");
-  factory1.createChannel("127.0.0.1", "20071");
-
-  BOOST_CHECK_EQUAL(channel1->isListening(), false);
-
-  channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated,   this, _1),
-                   bind(&EndToEndFixture::channel1_onConnectFailed, this, _1));
-
-  BOOST_CHECK_EQUAL(channel1->isListening(), true);
-
-  TcpFactory factory2;
-
-  shared_ptr<TcpChannel> channel2 = factory2.createChannel("127.0.0.2", "20070");
-  factory2.createChannel("127.0.0.2", "20071");
-
-  factory2.createFace(FaceUri("tcp4://127.0.0.1:20070"),
-                      ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-                      bind(&EndToEndFixture::channel2_onFaceCreated, this, _1),
-                      bind(&EndToEndFixture::channel2_onConnectFailed, this, _1));
-
-  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
-                      "TcpChannel error: cannot connect or cannot accept connection");
-
-  BOOST_REQUIRE(static_cast<bool>(face1));
-  BOOST_REQUIRE(static_cast<bool>(face2));
-
-  std::ostringstream hugeName;
-  hugeName << "/huge-name/";
-  for (size_t i = 0; i < ndn::MAX_NDN_PACKET_SIZE; i++)
-    hugeName << 'a';
-
-  shared_ptr<Interest> interest = makeInterest("ndn:/KfczhUqVix");
-  shared_ptr<Interest> hugeInterest = makeInterest(hugeName.str());
-
-  face1->sendInterest(*hugeInterest);
-  face2->sendInterest(*interest);
-  face2->sendInterest(*interest);
-
-  limitedIo.run(LimitedIo::UNLIMITED_OPS, time::seconds(1));
-  BOOST_TEST_MESSAGE("Unexpected assertion test passed");
-}
-
-class FakeNetworkInterfaceFixture : public BaseFixture
-{
-public:
-  FakeNetworkInterfaceFixture()
-  {
-    using namespace boost::asio::ip;
-
-    auto fakeInterfaces = make_shared<std::vector<NetworkInterfaceInfo>>();
-
-    fakeInterfaces->push_back(
-      NetworkInterfaceInfo {0, "eth0",
-        ethernet::Address::fromString("3e:15:c2:8b:65:00"),
-        {address_v4::from_string("0.0.0.0")},
-        {address_v6::from_string("::")},
-        address_v4(),
-        IFF_UP});
-    fakeInterfaces->push_back(
-      NetworkInterfaceInfo {1, "eth0",
-        ethernet::Address::fromString("3e:15:c2:8b:65:00"),
-        {address_v4::from_string("192.168.2.1"), address_v4::from_string("192.168.2.2")},
-        {},
-        address_v4::from_string("192.168.2.255"),
-        0});
-    fakeInterfaces->push_back(
-      NetworkInterfaceInfo {2, "eth1",
-        ethernet::Address::fromString("3e:15:c2:8b:65:00"),
-        {address_v4::from_string("198.51.100.1")},
-        {address_v6::from_string("2001:db8::2"), address_v6::from_string("2001:db8::3")},
-        address_v4::from_string("198.51.100.255"),
-        IFF_MULTICAST | IFF_BROADCAST | IFF_UP});
-
-    setDebugNetworkInterfaces(fakeInterfaces);
-  }
-
-  ~FakeNetworkInterfaceFixture()
-  {
-    setDebugNetworkInterfaces(nullptr);
-  }
-};
-
-BOOST_FIXTURE_TEST_CASE(Bug2292, FakeNetworkInterfaceFixture)
-{
-  using namespace boost::asio::ip;
-
-  TcpFactory factory;
-  factory.prohibitEndpoint(tcp::Endpoint(address_v4::from_string("192.168.2.1"), 1024));
-  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 1);
-  BOOST_CHECK((factory.m_prohibitedEndpoints ==
-               std::set<tcp::Endpoint> {
-                 tcp::Endpoint(address_v4::from_string("192.168.2.1"), 1024),
-               }));
-
-  factory.m_prohibitedEndpoints.clear();
-  factory.prohibitEndpoint(tcp::Endpoint(address_v6::from_string("2001:db8::1"), 2048));
-  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 1);
-  BOOST_CHECK((factory.m_prohibitedEndpoints ==
-               std::set<tcp::Endpoint> {
-                 tcp::Endpoint(address_v6::from_string("2001:db8::1"), 2048)
-               }));
-
-  factory.m_prohibitedEndpoints.clear();
-  factory.prohibitEndpoint(tcp::Endpoint(address_v4(), 1024));
-  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 4);
-  BOOST_CHECK((factory.m_prohibitedEndpoints ==
-               std::set<tcp::Endpoint> {
-                 tcp::Endpoint(address_v4::from_string("192.168.2.1"), 1024),
-                 tcp::Endpoint(address_v4::from_string("192.168.2.2"), 1024),
-                 tcp::Endpoint(address_v4::from_string("198.51.100.1"), 1024),
-                 tcp::Endpoint(address_v4::from_string("0.0.0.0"), 1024)
-               }));
-
-  factory.m_prohibitedEndpoints.clear();
-  factory.prohibitEndpoint(tcp::Endpoint(address_v6(), 2048));
-  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 3);
-  BOOST_CHECK((factory.m_prohibitedEndpoints ==
-               std::set<tcp::Endpoint> {
-                 tcp::Endpoint(address_v6::from_string("2001:db8::2"), 2048),
-                 tcp::Endpoint(address_v6::from_string("2001:db8::3"), 2048),
-                 tcp::Endpoint(address_v6::from_string("::"), 2048)
-               }));
-}
-
-BOOST_AUTO_TEST_SUITE_END() // TestTcp
-BOOST_AUTO_TEST_SUITE_END() // Face
-
-} // namespace tests
-} // namespace nfd
diff --git a/tests/daemon/face/transport.t.cpp b/tests/daemon/face/transport.t.cpp
index 8189859..9a59491 100644
--- a/tests/daemon/face/transport.t.cpp
+++ b/tests/daemon/face/transport.t.cpp
@@ -24,7 +24,7 @@
  */
 
 #include "face/transport.hpp"
-#include "face/lp-face.hpp"
+#include "face/face.hpp"
 #include "dummy-transport.hpp"
 #include "dummy-receive-link-service.hpp"
 #include "transport-test-common.hpp"
@@ -45,6 +45,8 @@
 
 BOOST_AUTO_TEST_SUITE(Face)
 
+using nfd::Face;
+
 class DummyTransportFixture : public BaseFixture
 {
 public:
@@ -60,14 +62,14 @@
   void
   initialize(unique_ptr<DummyTransport> transport = make_unique<DummyTransport>())
   {
-    this->face = make_unique<LpFace>(make_unique<DummyReceiveLinkService>(), std::move(transport));
+    this->face = make_unique<Face>(make_unique<DummyReceiveLinkService>(), std::move(transport));
     this->transport = static_cast<DummyTransport*>(face->getTransport());
     this->sentPackets = &this->transport->sentPackets;
     this->receivedPackets = &static_cast<DummyReceiveLinkService*>(face->getLinkService())->receivedPackets;
   }
 
 public:
-  unique_ptr<LpFace> face;
+  unique_ptr<Face> face;
   DummyTransport* transport;
   std::vector<Transport::Packet>* sentPackets;
   std::vector<Transport::Packet>* receivedPackets;
diff --git a/daemon/face/lp-face.cpp b/tests/daemon/face/udp-channel.t.cpp
similarity index 67%
copy from daemon/face/lp-face.cpp
copy to tests/daemon/face/udp-channel.t.cpp
index 55cc4d0..447ec0d 100644
--- a/daemon/face/lp-face.cpp
+++ b/tests/daemon/face/udp-channel.t.cpp
@@ -23,24 +23,25 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "lp-face.hpp"
+#include "face/udp-channel.hpp"
+
+#include "tests/test-common.hpp"
 
 namespace nfd {
-namespace face {
+namespace tests {
 
-LpFace::LpFace(unique_ptr<LinkService> service, unique_ptr<Transport> transport)
-  : afterReceiveInterest(service->afterReceiveInterest)
-  , afterReceiveData(service->afterReceiveData)
-  , afterReceiveNack(service->afterReceiveNack)
-  , afterStateChange(transport->afterStateChange)
-  , m_id(INVALID_FACEID)
-  , m_service(std::move(service))
-  , m_transport(std::move(transport))
-  , m_counters(m_service->getCounters(), m_transport->getCounters())
-{
-  m_service->setFaceAndTransport(*this, *m_transport);
-  m_transport->setFaceAndLinkService(*this, *m_service);
-}
+BOOST_AUTO_TEST_SUITE(Face)
+BOOST_FIXTURE_TEST_SUITE(TestUdpChannel, BaseFixture)
 
-} // namespace face
+using nfd::Face;
+
+// TODO add the equivalent of these test cases from udp.t.cpp as of commit:65caf200924b28748037750449e28bcb548dbc9c
+// MultipleAccepts
+// ManualClose
+// IdleClose
+
+BOOST_AUTO_TEST_SUITE_END() // TestUdpChannel
+BOOST_AUTO_TEST_SUITE_END() // Face
+
+} // namespace tests
 } // namespace nfd
diff --git a/tests/daemon/face/udp-factory.t.cpp b/tests/daemon/face/udp-factory.t.cpp
new file mode 100644
index 0000000..837262c
--- /dev/null
+++ b/tests/daemon/face/udp-factory.t.cpp
@@ -0,0 +1,335 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "face/udp-factory.hpp"
+
+#include "core/network-interface.hpp"
+#include "tests/test-common.hpp"
+#include "tests/limited-io.hpp"
+
+namespace nfd {
+namespace tests {
+
+BOOST_AUTO_TEST_SUITE(Face)
+BOOST_FIXTURE_TEST_SUITE(TestUdpFactory, BaseFixture)
+
+using nfd::Face;
+
+BOOST_AUTO_TEST_CASE(GetChannels)
+{
+  UdpFactory factory;
+  BOOST_REQUIRE_EQUAL(factory.getChannels().empty(), true);
+
+  std::vector<shared_ptr<const Channel>> expectedChannels;
+  expectedChannels.push_back(factory.createChannel("127.0.0.1", "20070"));
+  expectedChannels.push_back(factory.createChannel("127.0.0.1", "20071"));
+  expectedChannels.push_back(factory.createChannel("::1", "20071"));
+
+  for (const auto& i : factory.getChannels()) {
+    auto pos = std::find(expectedChannels.begin(), expectedChannels.end(), i);
+    BOOST_REQUIRE(pos != expectedChannels.end());
+    expectedChannels.erase(pos);
+  }
+
+  BOOST_CHECK_EQUAL(expectedChannels.size(), 0);
+}
+
+class FactoryErrorCheck : public BaseFixture
+{
+public:
+  bool
+  isTheSameMulticastEndpoint(const UdpFactory::Error& e) {
+    return strcmp(e.what(),
+                  "Cannot create the requested UDP unicast channel, local "
+                  "endpoint is already allocated for a UDP multicast face") == 0;
+  }
+
+  bool
+  isNotMulticastAddress(const UdpFactory::Error& e) {
+    return strcmp(e.what(),
+                  "Cannot create the requested UDP multicast face, "
+                  "the multicast group given as input is not a multicast address") == 0;
+  }
+
+  bool
+  isTheSameUnicastEndpoint(const UdpFactory::Error& e) {
+    return strcmp(e.what(),
+                  "Cannot create the requested UDP multicast face, local "
+                  "endpoint is already allocated for a UDP unicast channel") == 0;
+  }
+
+  bool
+  isLocalEndpointOnDifferentGroup(const UdpFactory::Error& e) {
+    return strcmp(e.what(),
+                  "Cannot create the requested UDP multicast face, local "
+                  "endpoint is already allocated for a UDP multicast face "
+                  "on a different multicast group") == 0;
+  }
+};
+
+BOOST_FIXTURE_TEST_CASE(ChannelMapUdp, FactoryErrorCheck)
+{
+  using boost::asio::ip::udp;
+
+  UdpFactory factory = UdpFactory();
+
+  //to instantiate multicast face on a specific ip address, change interfaceIp
+  std::string interfaceIp = "0.0.0.0";
+
+  shared_ptr<UdpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
+  shared_ptr<UdpChannel> channel1a = factory.createChannel("127.0.0.1", "20070");
+  BOOST_CHECK_EQUAL(channel1, channel1a);
+  BOOST_CHECK_EQUAL(channel1->getUri().toString(), "udp4://127.0.0.1:20070");
+
+  shared_ptr<UdpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
+  BOOST_CHECK_NE(channel1, channel2);
+
+  shared_ptr<UdpChannel> channel3 = factory.createChannel(interfaceIp, "20070");
+
+  shared_ptr<UdpChannel> channel4 = factory.createChannel("::1", "20071");
+  BOOST_CHECK_NE(channel2, channel4);
+  BOOST_CHECK_EQUAL(channel4->getUri().toString(), "udp6://[::1]:20071");
+
+  //same endpoint of a unicast channel
+  BOOST_CHECK_EXCEPTION(factory.createMulticastFace(interfaceIp, "224.0.0.1", "20070"),
+                        UdpFactory::Error, isTheSameUnicastEndpoint);
+
+  auto multicastFace1  = factory.createMulticastFace(interfaceIp, "224.0.0.1", "20072");
+  auto multicastFace1a = factory.createMulticastFace(interfaceIp, "224.0.0.1", "20072");
+  BOOST_CHECK_EQUAL(multicastFace1, multicastFace1a);
+
+  //same endpoint of a multicast face
+  BOOST_CHECK_EXCEPTION(factory.createChannel(interfaceIp, "20072"),
+                        UdpFactory::Error, isTheSameMulticastEndpoint);
+
+  //same multicast endpoint, different group
+  BOOST_CHECK_EXCEPTION(factory.createMulticastFace(interfaceIp, "224.0.0.42", "20072"),
+                        UdpFactory::Error, isLocalEndpointOnDifferentGroup);
+
+  BOOST_CHECK_EXCEPTION(factory.createMulticastFace(interfaceIp, "192.168.10.15", "20025"),
+                        UdpFactory::Error, isNotMulticastAddress);
+
+
+//  //Test commented because it required to be run in a machine that can resolve ipv6 query
+//  shared_ptr<UdpChannel> channel1v6 = factory.createChannel(//"::1",
+//                                                     "fe80::5e96:9dff:fe7d:9c8d%en1",
+//                                                     //"fe80::aa54:b2ff:fe08:27b8%wlan0",
+//                                                     "20070");
+//
+//  //the creation of multicastFace2 works properly. It has been disable because it needs an IP address of
+//  //an available network interface (different from the first one used)
+//  shared_ptr<MulticastUdpFace> multicastFace2 = factory.createMulticastFace("192.168.1.17",
+//                                                                            "224.0.0.1",
+//                                                                            "20073");
+//  BOOST_CHECK_NE(multicastFace1, multicastFace2);
+//
+//
+//  //ipv6 - work in progress
+//  shared_ptr<MulticastUdpFace> multicastFace3 = factory.createMulticastFace("fe80::5e96:9dff:fe7d:9c8d%en1",
+//                                                                            "FF01:0:0:0:0:0:0:2",
+//                                                                            "20073");
+//
+//  shared_ptr<MulticastUdpFace> multicastFace4 = factory.createMulticastFace("fe80::aa54:b2ff:fe08:27b8%wlan0",
+//                                                                            "FF01:0:0:0:0:0:0:2",
+//                                                                            "20073");
+//
+//  BOOST_CHECK_EQUAL(multicastFace3, multicastFace4);
+//
+//  shared_ptr<MulticastUdpFace> multicastFace5 = factory.createMulticastFace("::1",
+//                                                                            "FF01:0:0:0:0:0:0:2",
+//                                                                            "20073");
+//
+//  BOOST_CHECK_NE(multicastFace3, multicastFace5);
+//
+//  //same local ipv6 endpoint for a different multicast group
+//  BOOST_CHECK_THROW(factory.createMulticastFace("fe80::aa54:b2ff:fe08:27b8%wlan0",
+//                                                "FE01:0:0:0:0:0:0:2",
+//                                                "20073"),
+//                    UdpFactory::Error);
+//
+//  //same local ipv6 (expect for th port number) endpoint for a different multicast group
+//  BOOST_CHECK_THROW(factory.createMulticastFace("fe80::aa54:b2ff:fe08:27b8%wlan0",
+//                                                "FE01:0:0:0:0:0:0:2",
+//                                                "20075"),
+//                    UdpFactory::Error);
+//
+//  BOOST_CHECK_THROW(factory.createMulticastFace("fa80::20a:9dff:fef6:12ff",
+//                                                "FE12:0:0:0:0:0:0:2",
+//                                                "20075"),
+//                    UdpFactory::Error);
+//
+//  //not a multicast ipv6
+//  BOOST_CHECK_THROW(factory.createMulticastFace("fa80::20a:9dff:fef6:12ff",
+//                                                "A112:0:0:0:0:0:0:2",
+//                                                "20075"),
+//                    UdpFactory::Error);
+}
+
+class FaceCreateFixture : protected BaseFixture
+{
+public:
+  void
+  checkError(const std::string& errorActual, const std::string& errorExpected)
+  {
+    BOOST_CHECK_EQUAL(errorActual, errorExpected);
+  }
+
+  void
+  failIfError(const std::string& errorActual)
+  {
+    BOOST_FAIL("No error expected, but got: [" << errorActual << "]");
+  }
+};
+
+BOOST_FIXTURE_TEST_CASE(FaceCreate, FaceCreateFixture)
+{
+  UdpFactory factory = UdpFactory();
+
+  factory.createFace(FaceUri("udp4://127.0.0.1:6363"),
+                     ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+                     bind([]{}),
+                     bind(&FaceCreateFixture::checkError, this, _1,
+                          "No channels available to connect to 127.0.0.1:6363"));
+
+  factory.createChannel("127.0.0.1", "20071");
+
+  factory.createFace(FaceUri("udp4://127.0.0.1:20070"),
+                     ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+                     bind([]{}),
+                     bind(&FaceCreateFixture::failIfError, this, _1));
+  //test the upgrade
+  factory.createFace(FaceUri("udp4://127.0.0.1:20070"),
+                     ndn::nfd::FACE_PERSISTENCY_PERMANENT,
+                     bind([]{}),
+                     bind(&FaceCreateFixture::failIfError, this, _1));
+
+  factory.createFace(FaceUri("udp4://127.0.0.1:20072"),
+                     ndn::nfd::FACE_PERSISTENCY_PERMANENT,
+                     bind([]{}),
+                     bind(&FaceCreateFixture::failIfError, this, _1));
+}
+
+BOOST_AUTO_TEST_CASE(UnsupportedFaceCreate)
+{
+  UdpFactory factory;
+
+  factory.createChannel("127.0.0.1", "20070");
+
+  BOOST_CHECK_THROW(factory.createFace(FaceUri("udp4://127.0.0.1:20070"),
+                                       ndn::nfd::FACE_PERSISTENCY_ON_DEMAND,
+                                       bind([]{}),
+                                       bind([]{})),
+                    ProtocolFactory::Error);
+}
+
+class FakeNetworkInterfaceFixture : public BaseFixture
+{
+public:
+  FakeNetworkInterfaceFixture()
+  {
+    using namespace boost::asio::ip;
+
+    auto fakeInterfaces = make_shared<std::vector<NetworkInterfaceInfo>>();
+
+    fakeInterfaces->push_back(
+      NetworkInterfaceInfo {0, "eth0",
+        ethernet::Address::fromString("3e:15:c2:8b:65:00"),
+        {address_v4::from_string("0.0.0.0")},
+        {address_v6::from_string("::")},
+        address_v4(),
+        IFF_UP});
+    fakeInterfaces->push_back(
+      NetworkInterfaceInfo {1, "eth0",
+        ethernet::Address::fromString("3e:15:c2:8b:65:00"),
+        {address_v4::from_string("192.168.2.1"), address_v4::from_string("192.168.2.2")},
+        {},
+        address_v4::from_string("192.168.2.255"),
+        0});
+    fakeInterfaces->push_back(
+      NetworkInterfaceInfo {2, "eth1",
+        ethernet::Address::fromString("3e:15:c2:8b:65:00"),
+        {address_v4::from_string("198.51.100.1")},
+        {address_v6::from_string("2001:db8::2"), address_v6::from_string("2001:db8::3")},
+        address_v4::from_string("198.51.100.255"),
+        IFF_MULTICAST | IFF_BROADCAST | IFF_UP});
+
+    setDebugNetworkInterfaces(fakeInterfaces);
+  }
+
+  ~FakeNetworkInterfaceFixture()
+  {
+    setDebugNetworkInterfaces(nullptr);
+  }
+};
+
+BOOST_FIXTURE_TEST_CASE(Bug2292, FakeNetworkInterfaceFixture)
+{
+  using namespace boost::asio::ip;
+
+  UdpFactory factory;
+  factory.prohibitEndpoint(udp::Endpoint(address_v4::from_string("192.168.2.1"), 1024));
+  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 1);
+  BOOST_CHECK((factory.m_prohibitedEndpoints ==
+               std::set<udp::Endpoint> {
+                 udp::Endpoint(address_v4::from_string("192.168.2.1"), 1024),
+               }));
+
+  factory.m_prohibitedEndpoints.clear();
+  factory.prohibitEndpoint(udp::Endpoint(address_v6::from_string("2001:db8::1"), 2048));
+  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 1);
+  BOOST_CHECK((factory.m_prohibitedEndpoints ==
+               std::set<udp::Endpoint> {
+                 udp::Endpoint(address_v6::from_string("2001:db8::1"), 2048),
+               }));
+
+  factory.m_prohibitedEndpoints.clear();
+  factory.prohibitEndpoint(udp::Endpoint(address_v4(), 1024));
+  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 6);
+  BOOST_CHECK((factory.m_prohibitedEndpoints ==
+               std::set<udp::Endpoint> {
+                 udp::Endpoint(address_v4::from_string("192.168.2.1"), 1024),
+                 udp::Endpoint(address_v4::from_string("192.168.2.2"), 1024),
+                 udp::Endpoint(address_v4::from_string("198.51.100.1"), 1024),
+                 udp::Endpoint(address_v4::from_string("198.51.100.255"), 1024),
+                 udp::Endpoint(address_v4::from_string("255.255.255.255"), 1024),
+                 udp::Endpoint(address_v4::from_string("0.0.0.0"), 1024)
+               }));
+
+  factory.m_prohibitedEndpoints.clear();
+  factory.prohibitEndpoint(udp::Endpoint(address_v6(), 2048));
+  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 3);
+  BOOST_CHECK((factory.m_prohibitedEndpoints ==
+               std::set<udp::Endpoint> {
+                 udp::Endpoint(address_v6::from_string("2001:db8::2"), 2048),
+                 udp::Endpoint(address_v6::from_string("2001:db8::3"), 2048),
+                 udp::Endpoint(address_v6::from_string("::"), 2048),
+               }));
+}
+
+BOOST_AUTO_TEST_SUITE_END() // TestUdpFactory
+BOOST_AUTO_TEST_SUITE_END() // Face
+
+} // namespace tests
+} // namespace nfd
diff --git a/tests/daemon/face/udp.t.cpp b/tests/daemon/face/udp.t.cpp
deleted file mode 100644
index d38c908..0000000
--- a/tests/daemon/face/udp.t.cpp
+++ /dev/null
@@ -1,704 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  Regents of the University of California,
- *                           Arizona Board of Regents,
- *                           Colorado State University,
- *                           University Pierre & Marie Curie, Sorbonne University,
- *                           Washington University in St. Louis,
- *                           Beijing Institute of Technology,
- *                           The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "face/udp-channel.hpp"
-#include "face/udp-factory.hpp"
-
-#include "core/network-interface.hpp"
-#include "tests/test-common.hpp"
-#include "tests/limited-io.hpp"
-#include "face-history.hpp"
-
-namespace nfd {
-namespace tests {
-
-BOOST_AUTO_TEST_SUITE(Face)
-BOOST_FIXTURE_TEST_SUITE(TestUdp, BaseFixture)
-
-using nfd::Face;
-
-BOOST_AUTO_TEST_CASE(GetChannels)
-{
-  UdpFactory factory;
-  BOOST_REQUIRE_EQUAL(factory.getChannels().empty(), true);
-
-  std::vector<shared_ptr<const Channel>> expectedChannels;
-  expectedChannels.push_back(factory.createChannel("127.0.0.1", "20070"));
-  expectedChannels.push_back(factory.createChannel("127.0.0.1", "20071"));
-  expectedChannels.push_back(factory.createChannel("::1", "20071"));
-
-  for (const auto& i : factory.getChannels()) {
-    auto pos = std::find(expectedChannels.begin(), expectedChannels.end(), i);
-    BOOST_REQUIRE(pos != expectedChannels.end());
-    expectedChannels.erase(pos);
-  }
-
-  BOOST_CHECK_EQUAL(expectedChannels.size(), 0);
-}
-
-class FactoryErrorCheck : protected BaseFixture
-{
-public:
-  bool
-  isTheSameMulticastEndpoint(const UdpFactory::Error& e) {
-    return strcmp(e.what(),
-                  "Cannot create the requested UDP unicast channel, local "
-                  "endpoint is already allocated for a UDP multicast face") == 0;
-  }
-
-  bool
-  isNotMulticastAddress(const UdpFactory::Error& e) {
-    return strcmp(e.what(),
-                  "Cannot create the requested UDP multicast face, "
-                  "the multicast group given as input is not a multicast address") == 0;
-  }
-
-  bool
-  isTheSameUnicastEndpoint(const UdpFactory::Error& e) {
-    return strcmp(e.what(),
-                  "Cannot create the requested UDP multicast face, local "
-                  "endpoint is already allocated for a UDP unicast channel") == 0;
-  }
-
-  bool
-  isLocalEndpointOnDifferentGroup(const UdpFactory::Error& e) {
-    return strcmp(e.what(),
-                  "Cannot create the requested UDP multicast face, local "
-                  "endpoint is already allocated for a UDP multicast face "
-                  "on a different multicast group") == 0;
-  }
-};
-
-BOOST_FIXTURE_TEST_CASE(ChannelMapUdp, FactoryErrorCheck)
-{
-  using boost::asio::ip::udp;
-
-  UdpFactory factory = UdpFactory();
-
-  //to instantiate multicast face on a specific ip address, change interfaceIp
-  std::string interfaceIp = "0.0.0.0";
-
-  shared_ptr<UdpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
-  shared_ptr<UdpChannel> channel1a = factory.createChannel("127.0.0.1", "20070");
-  BOOST_CHECK_EQUAL(channel1, channel1a);
-  BOOST_CHECK_EQUAL(channel1->getUri().toString(), "udp4://127.0.0.1:20070");
-
-  shared_ptr<UdpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
-  BOOST_CHECK_NE(channel1, channel2);
-
-  shared_ptr<UdpChannel> channel3 = factory.createChannel(interfaceIp, "20070");
-
-  shared_ptr<UdpChannel> channel4 = factory.createChannel("::1", "20071");
-  BOOST_CHECK_NE(channel2, channel4);
-  BOOST_CHECK_EQUAL(channel4->getUri().toString(), "udp6://[::1]:20071");
-
-  //same endpoint of a unicast channel
-  BOOST_CHECK_EXCEPTION(factory.createMulticastFace(interfaceIp, "224.0.0.1", "20070"),
-                        UdpFactory::Error, isTheSameUnicastEndpoint);
-
-  auto multicastFace1  = factory.createMulticastFace(interfaceIp, "224.0.0.1", "20072");
-  auto multicastFace1a = factory.createMulticastFace(interfaceIp, "224.0.0.1", "20072");
-  BOOST_CHECK_EQUAL(multicastFace1, multicastFace1a);
-  BOOST_CHECK_EQUAL(multicastFace1->isLocal(), false);
-  BOOST_CHECK_EQUAL(multicastFace1->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERMANENT);
-  BOOST_CHECK_EQUAL(multicastFace1->isMultiAccess(), true);
-
-  //same endpoint of a multicast face
-  BOOST_CHECK_EXCEPTION(factory.createChannel(interfaceIp, "20072"),
-                        UdpFactory::Error, isTheSameMulticastEndpoint);
-
-  //same multicast endpoint, different group
-  BOOST_CHECK_EXCEPTION(factory.createMulticastFace(interfaceIp, "224.0.0.42", "20072"),
-                        UdpFactory::Error, isLocalEndpointOnDifferentGroup);
-
-  BOOST_CHECK_EXCEPTION(factory.createMulticastFace(interfaceIp, "192.168.10.15", "20025"),
-                        UdpFactory::Error, isNotMulticastAddress);
-
-
-//  //Test commented because it required to be run in a machine that can resolve ipv6 query
-//  shared_ptr<UdpChannel> channel1v6 = factory.createChannel(//"::1",
-//                                                     "fe80::5e96:9dff:fe7d:9c8d%en1",
-//                                                     //"fe80::aa54:b2ff:fe08:27b8%wlan0",
-//                                                     "20070");
-//
-//  //the creation of multicastFace2 works properly. It has been disable because it needs an IP address of
-//  //an available network interface (different from the first one used)
-//  shared_ptr<MulticastUdpFace> multicastFace2 = factory.createMulticastFace("192.168.1.17",
-//                                                                            "224.0.0.1",
-//                                                                            "20073");
-//  BOOST_CHECK_NE(multicastFace1, multicastFace2);
-//
-//
-//  //ipv6 - work in progress
-//  shared_ptr<MulticastUdpFace> multicastFace3 = factory.createMulticastFace("fe80::5e96:9dff:fe7d:9c8d%en1",
-//                                                                            "FF01:0:0:0:0:0:0:2",
-//                                                                            "20073");
-//
-//  shared_ptr<MulticastUdpFace> multicastFace4 = factory.createMulticastFace("fe80::aa54:b2ff:fe08:27b8%wlan0",
-//                                                                            "FF01:0:0:0:0:0:0:2",
-//                                                                            "20073");
-//
-//  BOOST_CHECK_EQUAL(multicastFace3, multicastFace4);
-//
-//  shared_ptr<MulticastUdpFace> multicastFace5 = factory.createMulticastFace("::1",
-//                                                                            "FF01:0:0:0:0:0:0:2",
-//                                                                            "20073");
-//
-//  BOOST_CHECK_NE(multicastFace3, multicastFace5);
-//
-//  //same local ipv6 endpoint for a different multicast group
-//  BOOST_CHECK_THROW(factory.createMulticastFace("fe80::aa54:b2ff:fe08:27b8%wlan0",
-//                                                "FE01:0:0:0:0:0:0:2",
-//                                                "20073"),
-//                    UdpFactory::Error);
-//
-//  //same local ipv6 (expect for th port number) endpoint for a different multicast group
-//  BOOST_CHECK_THROW(factory.createMulticastFace("fe80::aa54:b2ff:fe08:27b8%wlan0",
-//                                                "FE01:0:0:0:0:0:0:2",
-//                                                "20075"),
-//                    UdpFactory::Error);
-//
-//  BOOST_CHECK_THROW(factory.createMulticastFace("fa80::20a:9dff:fef6:12ff",
-//                                                "FE12:0:0:0:0:0:0:2",
-//                                                "20075"),
-//                    UdpFactory::Error);
-//
-//  //not a multicast ipv6
-//  BOOST_CHECK_THROW(factory.createMulticastFace("fa80::20a:9dff:fef6:12ff",
-//                                                "A112:0:0:0:0:0:0:2",
-//                                                "20075"),
-//                    UdpFactory::Error);
-}
-
-class FaceCreateFixture : protected BaseFixture
-{
-public:
-  void
-  checkError(const std::string& errorActual, const std::string& errorExpected)
-  {
-    BOOST_CHECK_EQUAL(errorActual, errorExpected);
-  }
-
-  void
-  failIfError(const std::string& errorActual)
-  {
-    BOOST_FAIL("No error expected, but got: [" << errorActual << "]");
-  }
-};
-
-BOOST_FIXTURE_TEST_CASE(FaceCreate, FaceCreateFixture)
-{
-  UdpFactory factory = UdpFactory();
-
-  factory.createFace(FaceUri("udp4://127.0.0.1:6363"),
-                     ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-                     bind([]{}),
-                     bind(&FaceCreateFixture::checkError, this, _1,
-                          "No channels available to connect to 127.0.0.1:6363"));
-
-  factory.createChannel("127.0.0.1", "20071");
-
-  factory.createFace(FaceUri("udp4://127.0.0.1:20070"),
-                     ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-                     bind([]{}),
-                     bind(&FaceCreateFixture::failIfError, this, _1));
-  //test the upgrade
-  factory.createFace(FaceUri("udp4://127.0.0.1:20070"),
-                     ndn::nfd::FACE_PERSISTENCY_PERMANENT,
-                     bind([]{}),
-                     bind(&FaceCreateFixture::failIfError, this, _1));
-
-  factory.createFace(FaceUri("udp4://127.0.0.1:20072"),
-                     ndn::nfd::FACE_PERSISTENCY_PERMANENT,
-                     bind([]{}),
-                     bind(&FaceCreateFixture::failIfError, this, _1));
-}
-
-BOOST_AUTO_TEST_CASE(UnsupportedFaceCreate)
-{
-  UdpFactory factory;
-
-  factory.createChannel("127.0.0.1", "20070");
-
-  BOOST_CHECK_THROW(factory.createFace(FaceUri("udp4://127.0.0.1:20070"),
-                                       ndn::nfd::FACE_PERSISTENCY_ON_DEMAND,
-                                       bind([]{}),
-                                       bind([]{})),
-                    ProtocolFactory::Error);
-}
-
-class EndToEndIpv4
-{
-public:
-  static const std::string
-  getScheme()
-  {
-    return "udp4";
-  }
-
-  static const std::string
-  getLocalIp()
-  {
-    return "127.0.0.1";
-  }
-
-  static const std::string
-  getPort1()
-  {
-    return "20071";
-  }
-
-  static const std::string
-  getPort2()
-  {
-    return "20072";
-  }
-
-  static const std::string
-  getPort3()
-  {
-    return "20073";
-  }
-
-  static const FaceUri
-  getFaceUri1()
-  {
-    return FaceUri("udp4://127.0.0.1:20071");
-  }
-
-  static const FaceUri
-  getFaceUri2()
-  {
-    return FaceUri("udp4://127.0.0.1:20072");
-  }
-
-  static const FaceUri
-  getFaceUri3()
-  {
-    return FaceUri("udp4://127.0.0.1:20073");
-  }
-};
-
-class EndToEndIpv6
-{
-public:
-  static const std::string
-  getScheme()
-  {
-    return "udp6";
-  }
-
-  static const std::string
-  getLocalIp()
-  {
-    return "::1";
-  }
-
-  static const std::string
-  getPort1()
-  {
-    return "20071";
-  }
-
-  static const std::string
-  getPort2()
-  {
-    return "20072";
-  }
-
-  static const std::string
-  getPort3()
-  {
-    return "20073";
-  }
-
-  static const FaceUri
-  getFaceUri1()
-  {
-    return FaceUri("udp6://[::1]:20071");
-  }
-
-  static const FaceUri
-  getFaceUri2()
-  {
-    return FaceUri("udp6://[::1]:20072");
-  }
-
-  static const FaceUri
-  getFaceUri3()
-  {
-    return FaceUri("udp6://[::1]:20073");
-  }
-};
-
-typedef boost::mpl::list<EndToEndIpv4, EndToEndIpv6> EndToEndAddresses;
-
-// end to end communication
-BOOST_AUTO_TEST_CASE_TEMPLATE(EndToEnd, A, EndToEndAddresses)
-{
-  LimitedIo limitedIo;
-  UdpFactory factory;
-
-  shared_ptr<UdpChannel> channel1 = factory.createChannel(A::getLocalIp(), A::getPort1());
-
-  // face1 (on channel1) connects to face2 (on channel2, to be created)
-  shared_ptr<Face> face1;
-  unique_ptr<FaceHistory> history1;
-  factory.createFace(A::getFaceUri2(),
-                     ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-                     [&] (shared_ptr<Face> newFace) {
-                       face1 = newFace;
-                       history1.reset(new FaceHistory(*face1, limitedIo));
-                       limitedIo.afterOp();
-                     },
-                     [] (const std::string& reason) { BOOST_ERROR(reason); });
-
-  limitedIo.run(1, time::seconds(1));
-  BOOST_REQUIRE(face1 != nullptr);
-  BOOST_CHECK_EQUAL(face1->getRemoteUri(), A::getFaceUri2());
-  BOOST_CHECK_EQUAL(face1->getLocalUri(), A::getFaceUri1());
-  BOOST_CHECK_EQUAL(face1->isLocal(), false); // UdpFace is never local
-  BOOST_CHECK_EQUAL(face1->getCounters().nInBytes, 0);
-  BOOST_CHECK_EQUAL(face1->getCounters().nOutBytes, 0);
-
-  // channel2 creation must be after face1 creation,
-  // otherwise channel2's endpoint would be prohibited
-  shared_ptr<UdpChannel> channel2 = factory.createChannel(A::getLocalIp(), A::getPort2());
-  shared_ptr<Face> face2;
-  unique_ptr<FaceHistory> history2;
-  channel2->listen([&] (shared_ptr<Face> newFace) {
-                     BOOST_CHECK(face2 == nullptr);
-                     face2 = newFace;
-                     history2.reset(new FaceHistory(*face2, limitedIo));
-                     limitedIo.afterOp();
-                   },
-                   [] (const std::string& reason) { BOOST_ERROR(reason); });
-
-  limitedIo.run(1, time::seconds(1));
-  BOOST_CHECK(face2 == nullptr); // face2 shouldn't be created until face1 sends something
-
-  shared_ptr<Interest> interest1 = makeInterest("/I1");
-  shared_ptr<Interest> interest2 = makeInterest("/I2");
-  shared_ptr<Data> data1 = makeData("/D1");
-  shared_ptr<Data> data2 = makeData("/D2");
-
-  // face1 sends to channel2, creates face2
-  face1->sendInterest(*interest1);
-  face1->sendData(*data1);
-  face1->sendData(*data1);
-  face1->sendData(*data1);
-  size_t nBytesSent1 = interest1->wireEncode().size() + 3 * data1->wireEncode().size();
-
-  limitedIo.run(5, time::seconds(1)); // 1 accept, 4 receives
-
-  BOOST_REQUIRE(face2 != nullptr);
-  BOOST_CHECK_EQUAL(face2->getRemoteUri(), A::getFaceUri1());
-  BOOST_CHECK_EQUAL(face2->getLocalUri(), A::getFaceUri2());
-  BOOST_CHECK_EQUAL(face2->isLocal(), false); // UdpFace is never local
-  BOOST_CHECK_EQUAL(face2->getCounters().nInBytes, nBytesSent1);
-  BOOST_CHECK_EQUAL(face2->getCounters().nOutBytes, 0);
-
-  BOOST_REQUIRE_EQUAL(history2->receivedInterests.size(), 1);
-  BOOST_CHECK_EQUAL(history2->receivedInterests.front().getName(), interest1->getName());
-  BOOST_REQUIRE_EQUAL(history2->receivedData.size(), 3);
-  BOOST_CHECK_EQUAL(history2->receivedData.front().getName(), data1->getName());
-
-  // face2 sends to face1
-  face2->sendInterest(*interest2);
-  face2->sendInterest(*interest2);
-  face2->sendInterest(*interest2);
-  face2->sendData(*data2);
-  size_t nBytesSent2 = 3 * interest2->wireEncode().size() + data2->wireEncode().size();
-
-  limitedIo.run(4, time::seconds(1)); // 4 receives
-
-  BOOST_REQUIRE_EQUAL(history1->receivedInterests.size(), 3);
-  BOOST_CHECK_EQUAL(history1->receivedInterests.front().getName(), interest2->getName());
-  BOOST_REQUIRE_EQUAL(history1->receivedData.size(), 1);
-  BOOST_CHECK_EQUAL(history1->receivedData.front().getName(), data2->getName());
-
-  // counters
-  const face::FaceCounters& counters1 = face1->getCounters();
-  BOOST_CHECK_EQUAL(counters1.nInInterests, 3);
-  BOOST_CHECK_EQUAL(counters1.nInData, 1);
-  BOOST_CHECK_EQUAL(counters1.nOutInterests, 1);
-  BOOST_CHECK_EQUAL(counters1.nOutData, 3);
-  BOOST_CHECK_EQUAL(counters1.nInBytes, nBytesSent2);
-  BOOST_CHECK_EQUAL(counters1.nOutBytes, nBytesSent1);
-
-  const face::FaceCounters& counters2 = face2->getCounters();
-  BOOST_CHECK_EQUAL(counters2.nInInterests, 1);
-  BOOST_CHECK_EQUAL(counters2.nInData, 3);
-  BOOST_CHECK_EQUAL(counters2.nOutInterests, 3);
-  BOOST_CHECK_EQUAL(counters2.nOutData, 1);
-  BOOST_CHECK_EQUAL(counters2.nInBytes, nBytesSent1);
-  BOOST_CHECK_EQUAL(counters2.nOutBytes, nBytesSent2);
-}
-
-// channel accepting multiple incoming connections
-BOOST_AUTO_TEST_CASE_TEMPLATE(MultipleAccepts, A, EndToEndAddresses)
-{
-  LimitedIo limitedIo;
-  UdpFactory factory;
-
-  // channel1 is listening
-  shared_ptr<UdpChannel> channel1 = factory.createChannel(A::getLocalIp(), A::getPort1());
-  std::vector<shared_ptr<Face>> faces1;
-  channel1->listen([&] (shared_ptr<Face> newFace) {
-                     faces1.push_back(newFace);
-                     limitedIo.afterOp();
-                   },
-                   [] (const std::string& reason) { BOOST_ERROR(reason); });
-
-  // face2 (on channel2) connects to channel1
-  shared_ptr<UdpChannel> channel2 = factory.createChannel(A::getLocalIp(), A::getPort2());
-  BOOST_CHECK_NE(channel1, channel2);
-  shared_ptr<Face> face2;
-  boost::asio::ip::address ipAddress2 = boost::asio::ip::address::from_string(A::getLocalIp());
-  udp::Endpoint endpoint2(ipAddress2, boost::lexical_cast<uint16_t>(A::getPort1()));
-  channel2->connect(endpoint2,
-                    ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-                    [&] (shared_ptr<Face> newFace) {
-                      face2 = newFace;
-                      limitedIo.afterOp();
-                    },
-                    [] (const std::string& reason) { BOOST_ERROR(reason); });
-
-  limitedIo.run(1, time::seconds(1)); // 1 create (on channel2)
-  BOOST_REQUIRE(face2 != nullptr);
-  BOOST_CHECK_EQUAL(faces1.size(), 0); // channel1 won't create face until face2 sends something
-
-  // face3 (on channel3) connects to channel1
-  shared_ptr<UdpChannel> channel3 = factory.createChannel(A::getLocalIp(), A::getPort3());
-  BOOST_CHECK_NE(channel1, channel3);
-  shared_ptr<Face> face3;
-  boost::asio::ip::address ipAddress3 = boost::asio::ip::address::from_string(A::getLocalIp());
-  udp::Endpoint endpoint3(ipAddress3, boost::lexical_cast<uint16_t>(A::getPort1()));
-  channel3->connect(endpoint3,
-                    ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-                    [&] (shared_ptr<Face> newFace) {
-                      face3 = newFace;
-                      limitedIo.afterOp();
-                    },
-                    [] (const std::string& reason) { BOOST_ERROR(reason); });
-
-  limitedIo.run(1, time::seconds(1)); // 1 create (on channel3)
-  BOOST_REQUIRE(face3 != nullptr);
-  BOOST_CHECK_EQUAL(faces1.size(), 0); // channel1 won't create face until face3 sends something
-
-  // face2 sends to channel1
-  shared_ptr<Interest> interest2 = makeInterest("/I2");
-  face2->sendInterest(*interest2);
-  limitedIo.run(1, time::milliseconds(100)); // 1 accept (on channel1)
-  BOOST_REQUIRE_EQUAL(faces1.size(), 1);
-  BOOST_CHECK_EQUAL(channel1->size(), 1);
-  BOOST_CHECK_EQUAL(faces1.at(0)->getRemoteUri(), A::getFaceUri2());
-
-  // face3 sends to channel1
-  shared_ptr<Data> data3 = makeData("/D3");
-  face3->sendData(*data3);
-  limitedIo.run(1, time::milliseconds(100)); // 1 accept (on channel1)
-  BOOST_REQUIRE_EQUAL(faces1.size(), 2);
-  BOOST_CHECK_EQUAL(channel1->size(), 2);
-  BOOST_CHECK_EQUAL(faces1.at(1)->getRemoteUri(), A::getFaceUri3());
-}
-
-// manually close a face
-BOOST_AUTO_TEST_CASE_TEMPLATE(ManualClose, A, EndToEndAddresses)
-{
-  LimitedIo limitedIo;
-  UdpFactory factory;
-
-  shared_ptr<UdpChannel> channel1 = factory.createChannel(A::getLocalIp(), A::getPort1());
-  shared_ptr<Face> face1;
-  unique_ptr<FaceHistory> history1;
-  factory.createFace(A::getFaceUri2(),
-                     ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-                     [&] (shared_ptr<Face> newFace) {
-                       face1 = newFace;
-                       history1.reset(new FaceHistory(*face1, limitedIo));
-                       limitedIo.afterOp();
-                     },
-                     [] (const std::string& reason) { BOOST_ERROR(reason); });
-
-  limitedIo.run(1, time::milliseconds(100));
-  BOOST_REQUIRE(face1 != nullptr);
-  BOOST_CHECK_EQUAL(channel1->size(), 1);
-
-  face1->close();
-  getGlobalIoService().poll();
-  BOOST_CHECK_EQUAL(history1->failures.size(), 1);
-  BOOST_CHECK_EQUAL(channel1->size(), 0);
-}
-
-// automatically close an idle incoming face
-BOOST_AUTO_TEST_CASE_TEMPLATE(IdleClose, A, EndToEndAddresses)
-{
-  LimitedIo limitedIo;
-  UdpFactory factory;
-
-  // channel1 is listening
-  shared_ptr<UdpChannel> channel1 = factory.createChannel(A::getLocalIp(), A::getPort1(),
-                                                          time::seconds(2));
-  shared_ptr<Face> face1;
-  unique_ptr<FaceHistory> history1;
-  channel1->listen([&] (shared_ptr<Face> newFace) {
-                     BOOST_CHECK(face1 == nullptr);
-                     face1 = newFace;
-                     history1.reset(new FaceHistory(*face1, limitedIo));
-                     limitedIo.afterOp();
-                   },
-                   [] (const std::string& reason) { BOOST_ERROR(reason); });
-
-  // face2 (on channel2) connects to channel1
-  shared_ptr<UdpChannel> channel2 = factory.createChannel(A::getLocalIp(), A::getPort2(),
-                                                          time::seconds(2));
-  shared_ptr<Face> face2;
-  unique_ptr<FaceHistory> history2;
-  boost::asio::ip::address ipAddress = boost::asio::ip::address::from_string(A::getLocalIp());
-  udp::Endpoint endpoint(ipAddress, boost::lexical_cast<uint16_t>(A::getPort1()));
-  channel2->connect(endpoint,
-                    ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-                    [&] (shared_ptr<Face> newFace) {
-                      face2 = newFace;
-                      history2.reset(new FaceHistory(*face2, limitedIo));
-                      limitedIo.afterOp();
-                    },
-                    [] (const std::string& reason) { BOOST_ERROR(reason); });
-
-  limitedIo.run(1, time::milliseconds(100)); // 1 create (on channel2)
-  BOOST_REQUIRE(face2 != nullptr);
-  BOOST_CHECK_EQUAL(face2->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
-  BOOST_CHECK_EQUAL(face2->isMultiAccess(), false);
-
-  // face2 sends to channel1, creates face1
-  shared_ptr<Interest> interest2 = makeInterest("/I2");
-  face2->sendInterest(*interest2);
-
-  limitedIo.run(2, time::seconds(1)); // 1 accept (on channel1), 1 receive (on face1)
-  BOOST_CHECK_EQUAL(channel1->size(), 1);
-  BOOST_REQUIRE(face1 != nullptr);
-  BOOST_CHECK_EQUAL(face1->getPersistency(), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
-  BOOST_CHECK_EQUAL(face1->isMultiAccess(), false);
-
-  limitedIo.defer(time::seconds(1));
-  BOOST_CHECK_EQUAL(history1->failures.size(), 0); // face1 is not idle
-  BOOST_CHECK_EQUAL(history2->failures.size(), 0); // face2 is outgoing face and never closed
-
-  limitedIo.defer(time::seconds(4));
-  BOOST_CHECK_EQUAL(history1->failures.size(), 1); // face1 is idle and automatically closed
-  BOOST_CHECK_EQUAL(channel1->size(), 0);
-  BOOST_CHECK_EQUAL(history2->failures.size(), 0); // face2 is outgoing face and never closed
-}
-
-class FakeNetworkInterfaceFixture : public BaseFixture
-{
-public:
-  FakeNetworkInterfaceFixture()
-  {
-    using namespace boost::asio::ip;
-
-    auto fakeInterfaces = make_shared<std::vector<NetworkInterfaceInfo>>();
-
-    fakeInterfaces->push_back(
-      NetworkInterfaceInfo {0, "eth0",
-        ethernet::Address::fromString("3e:15:c2:8b:65:00"),
-        {address_v4::from_string("0.0.0.0")},
-        {address_v6::from_string("::")},
-        address_v4(),
-        IFF_UP});
-    fakeInterfaces->push_back(
-      NetworkInterfaceInfo {1, "eth0",
-        ethernet::Address::fromString("3e:15:c2:8b:65:00"),
-        {address_v4::from_string("192.168.2.1"), address_v4::from_string("192.168.2.2")},
-        {},
-        address_v4::from_string("192.168.2.255"),
-        0});
-    fakeInterfaces->push_back(
-      NetworkInterfaceInfo {2, "eth1",
-        ethernet::Address::fromString("3e:15:c2:8b:65:00"),
-        {address_v4::from_string("198.51.100.1")},
-        {address_v6::from_string("2001:db8::2"), address_v6::from_string("2001:db8::3")},
-        address_v4::from_string("198.51.100.255"),
-        IFF_MULTICAST | IFF_BROADCAST | IFF_UP});
-
-    setDebugNetworkInterfaces(fakeInterfaces);
-  }
-
-  ~FakeNetworkInterfaceFixture()
-  {
-    setDebugNetworkInterfaces(nullptr);
-  }
-};
-
-BOOST_FIXTURE_TEST_CASE(Bug2292, FakeNetworkInterfaceFixture)
-{
-  using namespace boost::asio::ip;
-
-  UdpFactory factory;
-  factory.prohibitEndpoint(udp::Endpoint(address_v4::from_string("192.168.2.1"), 1024));
-  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 1);
-  BOOST_CHECK((factory.m_prohibitedEndpoints ==
-               std::set<udp::Endpoint> {
-                 udp::Endpoint(address_v4::from_string("192.168.2.1"), 1024),
-               }));
-
-  factory.m_prohibitedEndpoints.clear();
-  factory.prohibitEndpoint(udp::Endpoint(address_v6::from_string("2001:db8::1"), 2048));
-  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 1);
-  BOOST_CHECK((factory.m_prohibitedEndpoints ==
-               std::set<udp::Endpoint> {
-                 udp::Endpoint(address_v6::from_string("2001:db8::1"), 2048),
-               }));
-
-  factory.m_prohibitedEndpoints.clear();
-  factory.prohibitEndpoint(udp::Endpoint(address_v4(), 1024));
-  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 6);
-  BOOST_CHECK((factory.m_prohibitedEndpoints ==
-               std::set<udp::Endpoint> {
-                 udp::Endpoint(address_v4::from_string("192.168.2.1"), 1024),
-                 udp::Endpoint(address_v4::from_string("192.168.2.2"), 1024),
-                 udp::Endpoint(address_v4::from_string("198.51.100.1"), 1024),
-                 udp::Endpoint(address_v4::from_string("198.51.100.255"), 1024),
-                 udp::Endpoint(address_v4::from_string("255.255.255.255"), 1024),
-                 udp::Endpoint(address_v4::from_string("0.0.0.0"), 1024)
-               }));
-
-  factory.m_prohibitedEndpoints.clear();
-  factory.prohibitEndpoint(udp::Endpoint(address_v6(), 2048));
-  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 3);
-  BOOST_CHECK((factory.m_prohibitedEndpoints ==
-               std::set<udp::Endpoint> {
-                 udp::Endpoint(address_v6::from_string("2001:db8::2"), 2048),
-                 udp::Endpoint(address_v6::from_string("2001:db8::3"), 2048),
-                 udp::Endpoint(address_v6::from_string("::"), 2048),
-               }));
-}
-
-BOOST_AUTO_TEST_SUITE_END() // TestUdp
-BOOST_AUTO_TEST_SUITE_END() // Face
-
-} // namespace tests
-} // namespace nfd
diff --git a/tests/daemon/face/unicast-udp-transport-fixture.hpp b/tests/daemon/face/unicast-udp-transport-fixture.hpp
index 6dd836a..1ec37b0 100644
--- a/tests/daemon/face/unicast-udp-transport-fixture.hpp
+++ b/tests/daemon/face/unicast-udp-transport-fixture.hpp
@@ -27,7 +27,7 @@
 #define NFD_TESTS_DAEMON_FACE_UNICAST_UDP_TRANSPORT_FIXTURE_HPP
 
 #include "face/unicast-udp-transport.hpp"
-#include "face/lp-face.hpp"
+#include "face/face.hpp"
 
 #include "dummy-receive-link-service.hpp"
 #include "tests/limited-io.hpp"
@@ -60,9 +60,9 @@
 
     remoteConnect(address);
 
-    face = make_unique<LpFace>(make_unique<DummyReceiveLinkService>(),
-                               make_unique<UnicastUdpTransport>(std::move(sock), persistency,
-                                                                time::seconds(3)));
+    face = make_unique<Face>(
+             make_unique<DummyReceiveLinkService>(),
+             make_unique<UnicastUdpTransport>(std::move(sock), persistency, time::seconds(3)));
     transport = static_cast<UnicastUdpTransport*>(face->getTransport());
     receivedPackets = &static_cast<DummyReceiveLinkService*>(face->getLinkService())->receivedPackets;
 
@@ -99,7 +99,7 @@
   std::vector<Transport::Packet>* receivedPackets;
 
 private:
-  unique_ptr<LpFace> face;
+  unique_ptr<Face> face;
 };
 
 } // namespace tests
diff --git a/daemon/face/lp-face.cpp b/tests/daemon/face/unix-stream-channel.t.cpp
similarity index 67%
copy from daemon/face/lp-face.cpp
copy to tests/daemon/face/unix-stream-channel.t.cpp
index 55cc4d0..86caa8d 100644
--- a/daemon/face/lp-face.cpp
+++ b/tests/daemon/face/unix-stream-channel.t.cpp
@@ -23,24 +23,23 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "lp-face.hpp"
+#include "face/unix-stream-channel.hpp"
+
+#include "tests/test-common.hpp"
 
 namespace nfd {
-namespace face {
+namespace tests {
 
-LpFace::LpFace(unique_ptr<LinkService> service, unique_ptr<Transport> transport)
-  : afterReceiveInterest(service->afterReceiveInterest)
-  , afterReceiveData(service->afterReceiveData)
-  , afterReceiveNack(service->afterReceiveNack)
-  , afterStateChange(transport->afterStateChange)
-  , m_id(INVALID_FACEID)
-  , m_service(std::move(service))
-  , m_transport(std::move(transport))
-  , m_counters(m_service->getCounters(), m_transport->getCounters())
-{
-  m_service->setFaceAndTransport(*this, *m_transport);
-  m_transport->setFaceAndLinkService(*this, *m_service);
-}
+BOOST_AUTO_TEST_SUITE(Face)
+BOOST_FIXTURE_TEST_SUITE(TestUnixStreamChannel, BaseFixture)
 
-} // namespace face
+// TODO add the equivalent of these test cases from unix-stream.t.cpp as of commit:65caf200924b28748037750449e28bcb548dbc9c
+// MultipleAccepts
+
+// TODO add a test case to check a failed face is removed from the channel
+
+BOOST_AUTO_TEST_SUITE_END() // TestUnixStreamChannel
+BOOST_AUTO_TEST_SUITE_END() // Face
+
+} // namespace tests
 } // namespace nfd
diff --git a/tests/daemon/face/unix-stream-factory.t.cpp b/tests/daemon/face/unix-stream-factory.t.cpp
new file mode 100644
index 0000000..2be2536
--- /dev/null
+++ b/tests/daemon/face/unix-stream-factory.t.cpp
@@ -0,0 +1,103 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "face/unix-stream-factory.hpp"
+
+#include "tests/test-common.hpp"
+#include "tests/limited-io.hpp"
+
+namespace nfd {
+namespace tests {
+
+#define CHANNEL_PATH1 "unix-stream-test.1.sock"
+#define CHANNEL_PATH2 "unix-stream-test.2.sock"
+
+BOOST_AUTO_TEST_SUITE(Face)
+BOOST_FIXTURE_TEST_SUITE(TestUnixStreamFactory, BaseFixture)
+
+using nfd::Face;
+
+BOOST_AUTO_TEST_CASE(ChannelMap)
+{
+  UnixStreamFactory factory;
+
+  shared_ptr<UnixStreamChannel> channel1 = factory.createChannel(CHANNEL_PATH1);
+  shared_ptr<UnixStreamChannel> channel1a = factory.createChannel(CHANNEL_PATH1);
+  BOOST_CHECK_EQUAL(channel1, channel1a);
+  std::string channel1uri = channel1->getUri().toString();
+  BOOST_CHECK_EQUAL(channel1uri.find("unix:///"), 0); // third '/' is the path separator
+  BOOST_CHECK_EQUAL(channel1uri.rfind(CHANNEL_PATH1),
+                    channel1uri.size() - std::string(CHANNEL_PATH1).size());
+
+  shared_ptr<UnixStreamChannel> channel2 = factory.createChannel(CHANNEL_PATH2);
+  BOOST_CHECK_NE(channel1, channel2);
+}
+
+BOOST_AUTO_TEST_CASE(GetChannels)
+{
+  UnixStreamFactory factory;
+  BOOST_CHECK(factory.getChannels().empty());
+
+  std::vector<shared_ptr<const Channel>> expectedChannels;
+  expectedChannels.push_back(factory.createChannel(CHANNEL_PATH1));
+  expectedChannels.push_back(factory.createChannel(CHANNEL_PATH2));
+
+  for (const auto& channel : factory.getChannels()) {
+    auto pos = std::find(expectedChannels.begin(), expectedChannels.end(), channel);
+    BOOST_REQUIRE(pos != expectedChannels.end());
+    expectedChannels.erase(pos);
+  }
+
+  BOOST_CHECK_EQUAL(expectedChannels.size(), 0);
+}
+
+BOOST_AUTO_TEST_CASE(UnsupportedFaceCreate)
+{
+  UnixStreamFactory factory;
+
+  BOOST_CHECK_THROW(factory.createFace(FaceUri("unix:///var/run/nfd.sock"),
+                                       ndn::nfd::FACE_PERSISTENCY_PERMANENT,
+                                       bind([]{}),
+                                       bind([]{})),
+                    ProtocolFactory::Error);
+
+  BOOST_CHECK_THROW(factory.createFace(FaceUri("unix:///var/run/nfd.sock"),
+                                       ndn::nfd::FACE_PERSISTENCY_ON_DEMAND,
+                                       bind([]{}),
+                                       bind([]{})),
+                    ProtocolFactory::Error);
+
+  BOOST_CHECK_THROW(factory.createFace(FaceUri("unix:///var/run/nfd.sock"),
+                                       ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+                                       bind([]{}),
+                                       bind([]{})),
+                    ProtocolFactory::Error);
+}
+
+BOOST_AUTO_TEST_SUITE_END() // TestUnixStreamFactory
+BOOST_AUTO_TEST_SUITE_END() // Face
+
+} // namespace tests
+} // namespace nfd
diff --git a/tests/daemon/face/unix-stream-transport-fixture.hpp b/tests/daemon/face/unix-stream-transport-fixture.hpp
index 38c9b5f..0101f10 100644
--- a/tests/daemon/face/unix-stream-transport-fixture.hpp
+++ b/tests/daemon/face/unix-stream-transport-fixture.hpp
@@ -27,7 +27,7 @@
 #define NFD_TESTS_DAEMON_FACE_UNIX_STREAM_TRANSPORT_FIXTURE_HPP
 
 #include "face/unix-stream-transport.hpp"
-#include "face/lp-face.hpp"
+#include "face/face.hpp"
 
 #include "dummy-receive-link-service.hpp"
 #include "tests/limited-io.hpp"
@@ -105,8 +105,8 @@
     BOOST_REQUIRE_EQUAL(limitedIo.run(2, time::seconds(1)), LimitedIo::EXCEED_OPS);
 
     localEp = sock.local_endpoint();
-    face = make_unique<LpFace>(make_unique<DummyReceiveLinkService>(),
-                                make_unique<UnixStreamTransport>(std::move(sock)));
+    face = make_unique<Face>(make_unique<DummyReceiveLinkService>(),
+                             make_unique<UnixStreamTransport>(std::move(sock)));
     transport = static_cast<UnixStreamTransport*>(face->getTransport());
     receivedPackets = &static_cast<DummyReceiveLinkService*>(face->getLinkService())->receivedPackets;
 
@@ -134,7 +134,7 @@
 
 private:
   AcceptorWithCleanup acceptor;
-  unique_ptr<LpFace> face;
+  unique_ptr<Face> face;
 };
 
 } // namespace tests
diff --git a/tests/daemon/face/unix-stream.t.cpp b/tests/daemon/face/unix-stream.t.cpp
deleted file mode 100644
index fc528c2..0000000
--- a/tests/daemon/face/unix-stream.t.cpp
+++ /dev/null
@@ -1,347 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  Regents of the University of California,
- *                           Arizona Board of Regents,
- *                           Colorado State University,
- *                           University Pierre & Marie Curie, Sorbonne University,
- *                           Washington University in St. Louis,
- *                           Beijing Institute of Technology,
- *                           The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "face/unix-stream-channel.hpp"
-#include "face/unix-stream-factory.hpp"
-#include "face/unix-stream-transport.hpp"
-
-#include "face/generic-link-service.hpp"
-#include "face/lp-face-wrapper.hpp"
-
-#include "tests/test-common.hpp"
-#include "tests/limited-io.hpp"
-#include "dummy-stream-sender.hpp"
-#include "packet-datasets.hpp"
-
-namespace nfd {
-namespace tests {
-
-#define CHANNEL_PATH1 "unix-stream-test.1.sock"
-#define CHANNEL_PATH2 "unix-stream-test.2.sock"
-
-BOOST_AUTO_TEST_SUITE(Face)
-BOOST_FIXTURE_TEST_SUITE(TestUnixStream, BaseFixture)
-
-using nfd::Face;
-using face::LpFaceWrapper;
-using face::UnixStreamTransport;
-
-BOOST_AUTO_TEST_CASE(ChannelMap)
-{
-  UnixStreamFactory factory;
-
-  shared_ptr<UnixStreamChannel> channel1 = factory.createChannel(CHANNEL_PATH1);
-  shared_ptr<UnixStreamChannel> channel1a = factory.createChannel(CHANNEL_PATH1);
-  BOOST_CHECK_EQUAL(channel1, channel1a);
-  std::string channel1uri = channel1->getUri().toString();
-  BOOST_CHECK_EQUAL(channel1uri.find("unix:///"), 0); // third '/' is the path separator
-  BOOST_CHECK_EQUAL(channel1uri.rfind(CHANNEL_PATH1),
-                    channel1uri.size() - std::string(CHANNEL_PATH1).size());
-
-  shared_ptr<UnixStreamChannel> channel2 = factory.createChannel(CHANNEL_PATH2);
-  BOOST_CHECK_NE(channel1, channel2);
-}
-
-BOOST_AUTO_TEST_CASE(GetChannels)
-{
-  UnixStreamFactory factory;
-  BOOST_CHECK(factory.getChannels().empty());
-
-  std::vector<shared_ptr<const Channel>> expectedChannels;
-  expectedChannels.push_back(factory.createChannel(CHANNEL_PATH1));
-  expectedChannels.push_back(factory.createChannel(CHANNEL_PATH2));
-
-  for (const auto& channel : factory.getChannels()) {
-    auto pos = std::find(expectedChannels.begin(), expectedChannels.end(), channel);
-    BOOST_REQUIRE(pos != expectedChannels.end());
-    expectedChannels.erase(pos);
-  }
-
-  BOOST_CHECK_EQUAL(expectedChannels.size(), 0);
-}
-
-BOOST_AUTO_TEST_CASE(UnsupportedFaceCreate)
-{
-  UnixStreamFactory factory;
-
-  BOOST_CHECK_THROW(factory.createFace(FaceUri("unix:///var/run/nfd.sock"),
-                                       ndn::nfd::FACE_PERSISTENCY_PERMANENT,
-                                       bind([]{}),
-                                       bind([]{})),
-                    ProtocolFactory::Error);
-
-  BOOST_CHECK_THROW(factory.createFace(FaceUri("unix:///var/run/nfd.sock"),
-                                       ndn::nfd::FACE_PERSISTENCY_ON_DEMAND,
-                                       bind([]{}),
-                                       bind([]{})),
-                    ProtocolFactory::Error);
-
-  BOOST_CHECK_THROW(factory.createFace(FaceUri("unix:///var/run/nfd.sock"),
-                                       ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-                                       bind([]{}),
-                                       bind([]{})),
-                    ProtocolFactory::Error);
-}
-
-class EndToEndFixture : protected BaseFixture
-{
-public:
-  void
-  client_onConnect(const boost::system::error_code& error)
-  {
-    BOOST_CHECK_MESSAGE(!error, error.message());
-
-    limitedIo.afterOp();
-  }
-
-  void
-  channel1_onFaceCreated(const shared_ptr<Face>& newFace)
-  {
-    BOOST_CHECK(!static_cast<bool>(face1));
-    face1 = static_pointer_cast<LpFaceWrapper>(newFace);
-    face1->onReceiveInterest.connect(bind(&EndToEndFixture::face1_onReceiveInterest, this, _1));
-    face1->onReceiveData.connect(bind(&EndToEndFixture::face1_onReceiveData, this, _1));
-
-    limitedIo.afterOp();
-  }
-
-  void
-  channel1_onConnectFailed(const std::string& reason)
-  {
-    BOOST_CHECK_MESSAGE(false, reason);
-
-    limitedIo.afterOp();
-  }
-
-  void
-  face1_onReceiveInterest(const Interest& interest)
-  {
-    face1_receivedInterests.push_back(interest);
-
-    limitedIo.afterOp();
-  }
-
-  void
-  face1_onReceiveData(const Data& data)
-  {
-    face1_receivedDatas.push_back(data);
-
-    limitedIo.afterOp();
-  }
-
-  void
-  face2_onReceiveInterest(const Interest& interest)
-  {
-    face2_receivedInterests.push_back(interest);
-
-    limitedIo.afterOp();
-  }
-
-  void
-  face2_onReceiveData(const Data& data)
-  {
-    face2_receivedDatas.push_back(data);
-
-    limitedIo.afterOp();
-  }
-
-  void
-  channel_onFaceCreated(const shared_ptr<Face>& newFace)
-  {
-    faces.push_back(static_pointer_cast<LpFaceWrapper>(newFace));
-
-    limitedIo.afterOp();
-  }
-
-  void
-  channel_onConnectFailed(const std::string& reason)
-  {
-    BOOST_CHECK_MESSAGE(false, reason);
-
-    limitedIo.afterOp();
-  }
-
-  shared_ptr<LpFaceWrapper>
-  makeFace(UnixStreamTransport::protocol::socket&& socket)
-  {
-    auto linkService = make_unique<face::GenericLinkService>();
-    auto transport = make_unique<UnixStreamTransport>(std::move(socket));
-    auto lpFace = make_unique<LpFace>(std::move(linkService), std::move(transport));
-    return make_shared<LpFaceWrapper>(std::move(lpFace));
-  }
-
-protected:
-  LimitedIo limitedIo;
-
-  shared_ptr<LpFaceWrapper> face1;
-  std::vector<Interest> face1_receivedInterests;
-  std::vector<Data> face1_receivedDatas;
-  shared_ptr<LpFaceWrapper> face2;
-  std::vector<Interest> face2_receivedInterests;
-  std::vector<Data> face2_receivedDatas;
-
-  std::list<shared_ptr<LpFaceWrapper>> faces;
-};
-
-
-BOOST_FIXTURE_TEST_CASE(EndToEnd, EndToEndFixture)
-{
-  UnixStreamFactory factory;
-
-  shared_ptr<UnixStreamChannel> channel1 = factory.createChannel(CHANNEL_PATH1);
-  channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated,   this, _1),
-                   bind(&EndToEndFixture::channel1_onConnectFailed, this, _1));
-
-  UnixStreamTransport::protocol::socket client(g_io);
-  client.async_connect(UnixStreamTransport::protocol::endpoint(CHANNEL_PATH1),
-                       bind(&EndToEndFixture::client_onConnect, this, _1));
-
-  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS, "Connect");
-
-  BOOST_REQUIRE(static_cast<bool>(face1));
-  BOOST_CHECK_EQUAL(face1->isLocal(), true);
-  BOOST_CHECK_EQUAL(face1->getPersistency(), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
-  BOOST_CHECK_EQUAL(face1->isMultiAccess(), false);
-  BOOST_CHECK_EQUAL(face1->getRemoteUri().getScheme(), "fd");
-  BOOST_CHECK_NO_THROW(std::stoi(face1->getRemoteUri().getHost()));
-  std::string face1localUri = face1->getLocalUri().toString();
-  BOOST_CHECK_EQUAL(face1localUri.find("unix:///"), 0); // third '/' is the path separator
-  BOOST_CHECK_EQUAL(face1localUri.rfind(CHANNEL_PATH1),
-                    face1localUri.size() - std::string(CHANNEL_PATH1).size());
-
-  face2 = makeFace(std::move(client));
-  face2->onReceiveInterest.connect(bind(&EndToEndFixture::face2_onReceiveInterest, this, _1));
-  face2->onReceiveData.connect(bind(&EndToEndFixture::face2_onReceiveData, this, _1));
-
-  shared_ptr<Interest> interest1 = makeInterest("ndn:/TpnzGvW9R");
-  shared_ptr<Data>     data1     = makeData("ndn:/KfczhUqVix");
-  shared_ptr<Interest> interest2 = makeInterest("ndn:/QWiIMfj5sL");
-  shared_ptr<Data>     data2     = makeData("ndn:/XNBV796f");
-
-  face1->sendInterest(*interest1);
-  face1->sendInterest(*interest1);
-  face1->sendInterest(*interest1);
-  face1->sendData    (*data1    );
-  size_t nBytesSent1 = interest1->wireEncode().size() * 3 + data1->wireEncode().size();
-  face2->sendInterest(*interest2);
-  face2->sendData    (*data2    );
-  face2->sendData    (*data2    );
-  face2->sendData    (*data2    );
-  size_t nBytesSent2 = interest2->wireEncode().size() + data2->wireEncode().size() * 3;
-
-  BOOST_CHECK_MESSAGE(limitedIo.run(8, time::seconds(1)) == LimitedIo::EXCEED_OPS, "Send/receive");
-
-  BOOST_REQUIRE_EQUAL(face1_receivedInterests.size(), 1);
-  BOOST_REQUIRE_EQUAL(face1_receivedDatas    .size(), 3);
-  BOOST_REQUIRE_EQUAL(face2_receivedInterests.size(), 3);
-  BOOST_REQUIRE_EQUAL(face2_receivedDatas    .size(), 1);
-
-  BOOST_CHECK_EQUAL(face1_receivedInterests[0].getName(), interest2->getName());
-  BOOST_CHECK_EQUAL(face1_receivedDatas    [0].getName(), data2->getName());
-  BOOST_CHECK_EQUAL(face2_receivedInterests[0].getName(), interest1->getName());
-  BOOST_CHECK_EQUAL(face2_receivedDatas    [0].getName(), data1->getName());
-
-  // needed to ensure NOutBytes counters are accurate
-  limitedIo.run(LimitedIo::UNLIMITED_OPS, time::seconds(1));
-
-  const face::FaceCounters& counters1 = face1->getCounters();
-  BOOST_CHECK_EQUAL(counters1.nInInterests, 1);
-  BOOST_CHECK_EQUAL(counters1.nInData, 3);
-  BOOST_CHECK_EQUAL(counters1.nOutInterests, 3);
-  BOOST_CHECK_EQUAL(counters1.nOutData, 1);
-  BOOST_CHECK_EQUAL(counters1.nInBytes, nBytesSent2);
-  BOOST_CHECK_EQUAL(counters1.nOutBytes, nBytesSent1);
-
-  const face::FaceCounters& counters2 = face2->getCounters();
-  BOOST_CHECK_EQUAL(counters2.nInInterests, 3);
-  BOOST_CHECK_EQUAL(counters2.nInData, 1);
-  BOOST_CHECK_EQUAL(counters2.nOutInterests, 1);
-  BOOST_CHECK_EQUAL(counters2.nOutData, 3);
-}
-
-BOOST_FIXTURE_TEST_CASE(MultipleAccepts, EndToEndFixture)
-{
-  UnixStreamFactory factory;
-
-  shared_ptr<UnixStreamChannel> channel = factory.createChannel(CHANNEL_PATH1);
-  channel->listen(bind(&EndToEndFixture::channel_onFaceCreated,   this, _1),
-                  bind(&EndToEndFixture::channel_onConnectFailed, this, _1));
-
-  UnixStreamTransport::protocol::socket client1(g_io);
-  client1.async_connect(UnixStreamTransport::protocol::endpoint(CHANNEL_PATH1),
-                        bind(&EndToEndFixture::client_onConnect, this, _1));
-
-  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS, "First connect");
-
-  BOOST_CHECK_EQUAL(faces.size(), 1);
-
-  UnixStreamTransport::protocol::socket client2(g_io);
-  client2.async_connect(UnixStreamTransport::protocol::endpoint(CHANNEL_PATH1),
-                        bind(&EndToEndFixture::client_onConnect, this, _1));
-
-  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS, "Second connect");
-
-  BOOST_CHECK_EQUAL(faces.size(), 2);
-
-  // now close one of the faces
-  faces.front()->close();
-
-  // we should still be able to send/receive with the other one
-  face1 = faces.back();
-  face1->onReceiveInterest.connect(bind(&EndToEndFixture::face1_onReceiveInterest, this, _1));
-  face1->onReceiveData.connect(bind(&EndToEndFixture::face1_onReceiveData, this, _1));
-
-  face2 = makeFace(std::move(client2));
-  face2->onReceiveInterest.connect(bind(&EndToEndFixture::face2_onReceiveInterest, this, _1));
-  face2->onReceiveData.connect(bind(&EndToEndFixture::face2_onReceiveData, this, _1));
-
-  shared_ptr<Interest> interest1 = makeInterest("ndn:/TpnzGvW9R");
-  shared_ptr<Data>     data1     = makeData("ndn:/KfczhUqVix");
-  shared_ptr<Interest> interest2 = makeInterest("ndn:/QWiIMfj5sL");
-  shared_ptr<Data>     data2     = makeData("ndn:/XNBV796f");
-
-  face1->sendInterest(*interest1);
-  face1->sendData    (*data1    );
-  face2->sendInterest(*interest2);
-  face2->sendData    (*data2    );
-
-  BOOST_CHECK_MESSAGE(limitedIo.run(4, time::seconds(1)) == LimitedIo::EXCEED_OPS, "Send/receive");
-
-  BOOST_REQUIRE_EQUAL(face1_receivedInterests.size(), 1);
-  BOOST_REQUIRE_EQUAL(face1_receivedDatas    .size(), 1);
-  BOOST_REQUIRE_EQUAL(face2_receivedInterests.size(), 1);
-  BOOST_REQUIRE_EQUAL(face2_receivedDatas    .size(), 1);
-
-  BOOST_CHECK_EQUAL(face1_receivedInterests[0].getName(), interest2->getName());
-  BOOST_CHECK_EQUAL(face1_receivedDatas    [0].getName(), data2->getName());
-  BOOST_CHECK_EQUAL(face2_receivedInterests[0].getName(), interest1->getName());
-  BOOST_CHECK_EQUAL(face2_receivedDatas    [0].getName(), data1->getName());
-}
-
-BOOST_AUTO_TEST_SUITE_END() // TestUnixStream
-BOOST_AUTO_TEST_SUITE_END() // Face
-
-} // namespace tests
-} // namespace nfd
diff --git a/daemon/face/lp-face.cpp b/tests/daemon/face/websocket-channel.t.cpp
similarity index 67%
copy from daemon/face/lp-face.cpp
copy to tests/daemon/face/websocket-channel.t.cpp
index 55cc4d0..9e10239 100644
--- a/daemon/face/lp-face.cpp
+++ b/tests/daemon/face/websocket-channel.t.cpp
@@ -23,24 +23,22 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "lp-face.hpp"
+#include "face/websocket-channel.hpp"
+
+#include "tests/test-common.hpp"
 
 namespace nfd {
-namespace face {
+namespace tests {
 
-LpFace::LpFace(unique_ptr<LinkService> service, unique_ptr<Transport> transport)
-  : afterReceiveInterest(service->afterReceiveInterest)
-  , afterReceiveData(service->afterReceiveData)
-  , afterReceiveNack(service->afterReceiveNack)
-  , afterStateChange(transport->afterStateChange)
-  , m_id(INVALID_FACEID)
-  , m_service(std::move(service))
-  , m_transport(std::move(transport))
-  , m_counters(m_service->getCounters(), m_transport->getCounters())
-{
-  m_service->setFaceAndTransport(*this, *m_transport);
-  m_transport->setFaceAndLinkService(*this, *m_service);
-}
+BOOST_AUTO_TEST_SUITE(Face)
+BOOST_FIXTURE_TEST_SUITE(TestWebSocketChannel, BaseFixture)
 
-} // namespace face
+// TODO add a test case to accept multiple incoming connections on a channel
+
+// TODO add a test case to check a failed face is removed from the channel
+
+BOOST_AUTO_TEST_SUITE_END() // TestWebSocketChannel
+BOOST_AUTO_TEST_SUITE_END() // Face
+
+} // namespace tests
 } // namespace nfd
diff --git a/tests/daemon/face/websocket-factory.t.cpp b/tests/daemon/face/websocket-factory.t.cpp
new file mode 100644
index 0000000..9e469e8
--- /dev/null
+++ b/tests/daemon/face/websocket-factory.t.cpp
@@ -0,0 +1,85 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "face/websocket-factory.hpp"
+
+#include "tests/test-common.hpp"
+#include "tests/limited-io.hpp"
+
+namespace nfd {
+namespace tests {
+
+BOOST_AUTO_TEST_SUITE(Face)
+BOOST_FIXTURE_TEST_SUITE(TestWebSocketFactory, BaseFixture)
+
+using nfd::Face;
+
+BOOST_AUTO_TEST_CASE(GetChannels)
+{
+  WebSocketFactory factory;
+  BOOST_REQUIRE_EQUAL(factory.getChannels().empty(), true);
+
+  std::vector<shared_ptr<const Channel>> expectedChannels;
+  expectedChannels.push_back(factory.createChannel("127.0.0.1", "20070"));
+  expectedChannels.push_back(factory.createChannel("127.0.0.1", "20071"));
+  expectedChannels.push_back(factory.createChannel("::1", "20071"));
+
+  for (const auto& i : factory.getChannels()) {
+    auto pos = std::find(expectedChannels.begin(), expectedChannels.end(), i);
+    BOOST_REQUIRE(pos != expectedChannels.end());
+    expectedChannels.erase(pos);
+  }
+
+  BOOST_CHECK_EQUAL(expectedChannels.size(), 0);
+}
+
+BOOST_AUTO_TEST_CASE(UnsupportedFaceCreate)
+{
+  WebSocketFactory factory;
+
+  BOOST_CHECK_THROW(factory.createFace(FaceUri("ws://127.0.0.1:20070"),
+                                       ndn::nfd::FACE_PERSISTENCY_PERMANENT,
+                                       bind([]{}),
+                                       bind([]{})),
+                    ProtocolFactory::Error);
+
+  BOOST_CHECK_THROW(factory.createFace(FaceUri("ws://127.0.0.1:20070"),
+                                       ndn::nfd::FACE_PERSISTENCY_ON_DEMAND,
+                                       bind([]{}),
+                                       bind([]{})),
+                    ProtocolFactory::Error);
+
+  BOOST_CHECK_THROW(factory.createFace(FaceUri("ws://127.0.0.1:20070"),
+                                       ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+                                       bind([]{}),
+                                       bind([]{})),
+                    ProtocolFactory::Error);
+}
+
+BOOST_AUTO_TEST_SUITE_END() // TestWebSocketFactory
+BOOST_AUTO_TEST_SUITE_END() // Face
+
+} // namespace tests
+} // namespace nfd
diff --git a/tests/daemon/face/websocket-transport.t.cpp b/tests/daemon/face/websocket-transport.t.cpp
index ca9bd72..edee799 100644
--- a/tests/daemon/face/websocket-transport.t.cpp
+++ b/tests/daemon/face/websocket-transport.t.cpp
@@ -24,7 +24,7 @@
  */
 
 #include "face/websocket-transport.hpp"
-#include "face/lp-face.hpp"
+#include "face/face.hpp"
 #include "dummy-receive-link-service.hpp"
 #include "transport-test-common.hpp"
 
@@ -39,6 +39,8 @@
 
 BOOST_AUTO_TEST_SUITE(Face)
 
+using nfd::Face;
+
 /** \brief a fixture that accepts a single WebSocket connection from a client
  */
 class SingleWebSocketFixture : public BaseFixture
@@ -97,7 +99,7 @@
   void
   makeFace(const time::milliseconds& pingInterval = time::milliseconds(10000))
   {
-    face = make_unique<LpFace>(
+    face = make_unique<Face>(
              make_unique<DummyReceiveLinkService>(),
              make_unique<WebSocketTransport>(serverHdl, ref(server), pingInterval));
     transport = static_cast<WebSocketTransport*>(face->getTransport());
@@ -197,7 +199,7 @@
 
   websocket::Server server;
   websocketpp::connection_hdl serverHdl;
-  unique_ptr<LpFace> face;
+  unique_ptr<Face> face;
   WebSocketTransport* transport;
   std::vector<Transport::Packet>* serverReceivedPackets;
 
diff --git a/tests/daemon/face/websocket.t.cpp b/tests/daemon/face/websocket.t.cpp
deleted file mode 100644
index 3811635..0000000
--- a/tests/daemon/face/websocket.t.cpp
+++ /dev/null
@@ -1,306 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  Regents of the University of California,
- *                           Arizona Board of Regents,
- *                           Colorado State University,
- *                           University Pierre & Marie Curie, Sorbonne University,
- *                           Washington University in St. Louis,
- *                           Beijing Institute of Technology,
- *                           The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "face/websocket-channel.hpp"
-#include "face/websocket-factory.hpp"
-#include "face/websocketpp.hpp"
-
-#include "tests/test-common.hpp"
-#include "tests/limited-io.hpp"
-
-namespace nfd {
-namespace tests {
-
-BOOST_AUTO_TEST_SUITE(Face)
-BOOST_FIXTURE_TEST_SUITE(TestWebSocket, BaseFixture)
-
-using nfd::Face;
-
-BOOST_AUTO_TEST_CASE(GetChannels)
-{
-  WebSocketFactory factory;
-  BOOST_REQUIRE_EQUAL(factory.getChannels().empty(), true);
-
-  std::vector<shared_ptr<const Channel>> expectedChannels;
-  expectedChannels.push_back(factory.createChannel("127.0.0.1", "20070"));
-  expectedChannels.push_back(factory.createChannel("127.0.0.1", "20071"));
-  expectedChannels.push_back(factory.createChannel("::1", "20071"));
-
-  for (const auto& i : factory.getChannels()) {
-    auto pos = std::find(expectedChannels.begin(), expectedChannels.end(), i);
-    BOOST_REQUIRE(pos != expectedChannels.end());
-    expectedChannels.erase(pos);
-  }
-
-  BOOST_CHECK_EQUAL(expectedChannels.size(), 0);
-}
-
-BOOST_AUTO_TEST_CASE(UnsupportedFaceCreate)
-{
-  WebSocketFactory factory;
-
-  BOOST_CHECK_THROW(factory.createFace(FaceUri("ws://127.0.0.1:20070"),
-                                       ndn::nfd::FACE_PERSISTENCY_PERMANENT,
-                                       bind([]{}),
-                                       bind([]{})),
-                    ProtocolFactory::Error);
-
-  BOOST_CHECK_THROW(factory.createFace(FaceUri("ws://127.0.0.1:20070"),
-                                       ndn::nfd::FACE_PERSISTENCY_ON_DEMAND,
-                                       bind([]{}),
-                                       bind([]{})),
-                    ProtocolFactory::Error);
-
-  BOOST_CHECK_THROW(factory.createFace(FaceUri("ws://127.0.0.1:20070"),
-                                       ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-                                       bind([]{}),
-                                       bind([]{})),
-                    ProtocolFactory::Error);
-}
-
-class EndToEndFixture : protected BaseFixture
-{
-public:
-  void
-  channel1_onFaceCreated(const shared_ptr<Face>& newFace)
-  {
-    BOOST_CHECK(!static_cast<bool>(face1));
-    face1 = newFace;
-    face1->onReceiveInterest.connect(bind(&EndToEndFixture::face1_onReceiveInterest, this, _1));
-    face1->onReceiveData.connect(bind(&EndToEndFixture::face1_onReceiveData, this, _1));
-    face1->onFail.connect(bind(&EndToEndFixture::face1_onFail, this));
-
-    limitedIo.afterOp();
-  }
-
-  void
-  face1_onReceiveInterest(const Interest& interest)
-  {
-    face1_receivedInterests.push_back(interest);
-    limitedIo.afterOp();
-  }
-
-  void
-  face1_onReceiveData(const Data& data)
-  {
-    face1_receivedDatas.push_back(data);
-    limitedIo.afterOp();
-  }
-
-  void
-  face1_onFail()
-  {
-    g_io.post([this] {
-      face1.reset();
-      limitedIo.afterOp();
-    });
-  }
-
-  void
-  client1_onOpen(websocketpp::connection_hdl hdl)
-  {
-    handle = hdl;
-    limitedIo.afterOp();
-  }
-
-  void
-  client1_onClose(websocketpp::connection_hdl hdl)
-  {
-    limitedIo.afterOp();
-  }
-
-  void
-  client1_onFail(websocketpp::connection_hdl hdl)
-  {
-    limitedIo.afterOp();
-  }
-
-  bool
-  client1_onPing(websocketpp::connection_hdl hdl, std::string msg)
-  {
-    limitedIo.afterOp();
-    // Return false to suppress the pong response,
-    // which will cause timeout in the websocket channel
-    return false;
-  }
-
-  void
-  client1_sendInterest(const Interest& interest)
-  {
-    const Block& payload = interest.wireEncode();
-    client1.send(handle, payload.wire(), payload.size(), websocketpp::frame::opcode::binary);
-  }
-
-  void
-  client1_sendData(const Data& data)
-  {
-    const Block& payload = data.wireEncode();
-    client1.send(handle, payload.wire(), payload.size(), websocketpp::frame::opcode::binary);
-  }
-
-  void
-  client1_onMessage(websocketpp::connection_hdl hdl,
-                    websocketpp::config::asio_client::message_type::ptr msg)
-  {
-    bool isOk = false;
-    Block element;
-    const std::string& payload = msg->get_payload();
-    std::tie(isOk, element) = Block::fromBuffer(reinterpret_cast<const uint8_t*>(payload.c_str()),
-                                                payload.size());
-    if (isOk)
-      {
-        try {
-          if (element.type() == tlv::Interest)
-            {
-              shared_ptr<Interest> i = make_shared<Interest>();
-              i->wireDecode(element);
-              client1_onReceiveInterest(*i);
-            }
-          else if (element.type() == tlv::Data)
-            {
-              shared_ptr<Data> d = make_shared<Data>();
-              d->wireDecode(element);
-              client1_onReceiveData(*d);
-            }
-        }
-        catch (tlv::Error&) {
-          // Do something?
-        }
-      }
-    limitedIo.afterOp();
-  }
-
-  void
-  client1_onReceiveInterest(const Interest& interest)
-  {
-    client1_receivedInterests.push_back(interest);
-    limitedIo.afterOp();
-  }
-
-  void
-  client1_onReceiveData(const Data& data)
-  {
-    client1_receivedDatas.push_back(data);
-    limitedIo.afterOp();
-  }
-
-public:
-  LimitedIo limitedIo;
-
-  shared_ptr<Face> face1;
-  std::vector<Interest> face1_receivedInterests;
-  std::vector<Data> face1_receivedDatas;
-  websocket::Client client1;
-  websocketpp::connection_hdl handle;
-  std::vector<Interest> client1_receivedInterests;
-  std::vector<Data> client1_receivedDatas;
-};
-
-BOOST_FIXTURE_TEST_CASE(EndToEnd4, EndToEndFixture)
-{
-  WebSocketFactory factory1;
-
-  shared_ptr<WebSocketChannel> channel1 = factory1.createChannel("127.0.0.1", "20070");
-  channel1->setPingInterval(time::milliseconds(3000));
-  channel1->setPongTimeout(time::milliseconds(1000));
-
-  BOOST_CHECK_EQUAL(channel1->isListening(), false);
-
-  channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated,   this, _1));
-
-  BOOST_CHECK_EQUAL(channel1->isListening(), true);
-
-  // Clear all logging info from websocketpp library
-  client1.clear_access_channels(websocketpp::log::alevel::all);
-
-  client1.init_asio(&getGlobalIoService());
-  client1.set_open_handler(bind(&EndToEndFixture::client1_onOpen,   this, _1));
-  client1.set_close_handler(bind(&EndToEndFixture::client1_onClose, this, _1));
-  client1.set_fail_handler(bind(&EndToEndFixture::client1_onFail,   this, _1));
-  client1.set_message_handler(bind(&EndToEndFixture::client1_onMessage, this, _1, _2));
-  client1.set_ping_handler(bind(&EndToEndFixture::client1_onPing, this, _1, _2));
-
-  websocketpp::lib::error_code ec;
-  auto con = client1.get_connection("ws://127.0.0.1:20070", ec);
-  client1.connect(con);
-
-  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
-                      "WebSocketChannel error: cannot connect or cannot accept connection");
-
-  BOOST_CHECK_EQUAL(channel1->size(), 1);
-
-  BOOST_REQUIRE(static_cast<bool>(face1));
-  BOOST_CHECK_EQUAL(face1->isLocal(), true);
-  BOOST_CHECK_EQUAL(face1->getPersistency(), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
-  BOOST_CHECK_EQUAL(face1->isMultiAccess(), false);
-  BOOST_CHECK_EQUAL(face1->getLocalUri().toString(), "ws://127.0.0.1:20070");
-
-  shared_ptr<Interest> interest1 = makeInterest("ndn:/TpnzGvW9R");
-  shared_ptr<Data>     data1     = makeData("ndn:/KfczhUqVix");
-  shared_ptr<Interest> interest2 = makeInterest("ndn:/QWiIMfj5sL");
-  shared_ptr<Data>     data2     = makeData("ndn:/XNBV796f");
-
-  client1_sendInterest(*interest1);
-  client1_sendInterest(*interest1);
-  client1_sendInterest(*interest1);
-  face1->sendData     (*data1);
-  face1->sendInterest (*interest2);
-  client1_sendData    (*data2);
-  client1_sendData    (*data2);
-  client1_sendData    (*data2);
-
-  size_t nBytesSent = data1->wireEncode().size() + interest2->wireEncode().size();
-  size_t nBytesReceived = interest1->wireEncode().size() * 3 + data2->wireEncode().size() * 3;
-
-  BOOST_CHECK_MESSAGE(limitedIo.run(8, time::seconds(10)) == LimitedIo::EXCEED_OPS,
-                      "WebSocketChannel error: cannot send or receive Interest/Data packets");
-
-  BOOST_REQUIRE_EQUAL(face1_receivedInterests.size(), 3);
-  BOOST_REQUIRE_EQUAL(face1_receivedDatas    .size(), 3);
-  BOOST_REQUIRE_EQUAL(client1_receivedInterests.size(), 1);
-  BOOST_REQUIRE_EQUAL(client1_receivedDatas    .size(), 1);
-
-  BOOST_CHECK_EQUAL(face1_receivedInterests[0].getName(), interest1->getName());
-  BOOST_CHECK_EQUAL(face1_receivedDatas    [0].getName(), data2->getName());
-  BOOST_CHECK_EQUAL(client1_receivedInterests[0].getName(), interest2->getName());
-  BOOST_CHECK_EQUAL(client1_receivedDatas    [0].getName(), data1->getName());
-
-  const face::FaceCounters& counters1 = face1->getCounters();
-  BOOST_CHECK_EQUAL(counters1.nInInterests, 3);
-  BOOST_CHECK_EQUAL(counters1.nInData, 3);
-  BOOST_CHECK_EQUAL(counters1.nOutInterests, 1);
-  BOOST_CHECK_EQUAL(counters1.nOutData, 1);
-  BOOST_CHECK_EQUAL(counters1.nInBytes, nBytesReceived);
-  BOOST_CHECK_EQUAL(counters1.nOutBytes, nBytesSent);
-
-  limitedIo.run(LimitedIo::UNLIMITED_OPS, time::seconds(8));
-  BOOST_CHECK_EQUAL(channel1->size(), 0);
-}
-
-BOOST_AUTO_TEST_SUITE_END() // TestWebSocket
-BOOST_AUTO_TEST_SUITE_END() // Face
-
-} // namespace tests
-} // namespace nfd
diff --git a/tests/daemon/fw/client-control-strategy.t.cpp b/tests/daemon/fw/client-control-strategy.t.cpp
index 8f0870b..e180ec9 100644
--- a/tests/daemon/fw/client-control-strategy.t.cpp
+++ b/tests/daemon/fw/client-control-strategy.t.cpp
@@ -44,10 +44,10 @@
   typedef StrategyTester<fw::ClientControlStrategy> ClientControlStrategyTester;
   ClientControlStrategyTester strategy(forwarder);
 
-  shared_ptr<DummyFace> face1 = make_shared<DummyFace>();
-  shared_ptr<DummyFace> face2 = make_shared<DummyFace>();
-  shared_ptr<DummyFace> face3 = make_shared<DummyFace>();
-  shared_ptr<DummyLocalFace> face4 = make_shared<DummyLocalFace>();
+  auto face1 = make_shared<DummyFace>();
+  auto face2 = make_shared<DummyFace>();
+  auto face3 = make_shared<DummyFace>();
+  auto face4 = make_shared<DummyFace>("dummy://", "dummy://", ndn::nfd::FACE_SCOPE_LOCAL);
   forwarder.addFace(face1);
   forwarder.addFace(face2);
   forwarder.addFace(face3);
diff --git a/tests/daemon/fw/face-table.t.cpp b/tests/daemon/fw/face-table.t.cpp
index 6610034..59bb7c8 100644
--- a/tests/daemon/fw/face-table.t.cpp
+++ b/tests/daemon/fw/face-table.t.cpp
@@ -32,52 +32,49 @@
 namespace nfd {
 namespace tests {
 
-BOOST_FIXTURE_TEST_SUITE(FwFaceTable, BaseFixture)
+BOOST_AUTO_TEST_SUITE(Fw)
+BOOST_FIXTURE_TEST_SUITE(TestFaceTable, BaseFixture)
 
 BOOST_AUTO_TEST_CASE(AddRemove)
 {
   Forwarder forwarder;
 
   FaceTable& faceTable = forwarder.getFaceTable();
-  std::vector<FaceId> onAddHistory;
-  std::vector<FaceId> onRemoveHistory;
-  faceTable.onAdd.connect([&] (shared_ptr<Face> face) {
-    onAddHistory.push_back(face->getId());
-  });
-  faceTable.onRemove.connect([&] (shared_ptr<Face> face) {
-    onRemoveHistory.push_back(face->getId());
-  });
+  std::vector<FaceId> addHistory;
+  std::vector<FaceId> removeHistory;
+  faceTable.afterAdd.connect([&] (shared_ptr<Face> face) { addHistory.push_back(face->getId()); });
+  faceTable.beforeRemove.connect([&] (shared_ptr<Face> face) { removeHistory.push_back(face->getId()); });
 
   shared_ptr<Face> face1 = make_shared<DummyFace>();
   shared_ptr<Face> face2 = make_shared<DummyFace>();
 
-  BOOST_CHECK_EQUAL(face1->getId(), INVALID_FACEID);
-  BOOST_CHECK_EQUAL(face2->getId(), INVALID_FACEID);
+  BOOST_CHECK_EQUAL(face1->getId(), face::INVALID_FACEID);
+  BOOST_CHECK_EQUAL(face2->getId(), face::INVALID_FACEID);
 
   forwarder.addFace(face1);
   forwarder.addFace(face2);
 
-  BOOST_CHECK_NE(face1->getId(), INVALID_FACEID);
-  BOOST_CHECK_NE(face2->getId(), INVALID_FACEID);
+  BOOST_CHECK_NE(face1->getId(), face::INVALID_FACEID);
+  BOOST_CHECK_NE(face2->getId(), face::INVALID_FACEID);
   BOOST_CHECK_NE(face1->getId(), face2->getId());
-  BOOST_CHECK_GT(face1->getId(), FACEID_RESERVED_MAX);
-  BOOST_CHECK_GT(face2->getId(), FACEID_RESERVED_MAX);
+  BOOST_CHECK_GT(face1->getId(), face::FACEID_RESERVED_MAX);
+  BOOST_CHECK_GT(face2->getId(), face::FACEID_RESERVED_MAX);
 
   FaceId oldId1 = face1->getId();
   faceTable.add(face1);
   BOOST_CHECK_EQUAL(face1->getId(), oldId1);
   BOOST_CHECK_EQUAL(faceTable.size(), 2);
 
-  BOOST_REQUIRE_EQUAL(onAddHistory.size(), 2);
-  BOOST_CHECK_EQUAL(onAddHistory[0], face1->getId());
-  BOOST_CHECK_EQUAL(onAddHistory[1], face2->getId());
+  BOOST_REQUIRE_EQUAL(addHistory.size(), 2);
+  BOOST_CHECK_EQUAL(addHistory[0], face1->getId());
+  BOOST_CHECK_EQUAL(addHistory[1], face2->getId());
 
   face1->close();
 
-  BOOST_CHECK_EQUAL(face1->getId(), INVALID_FACEID);
+  BOOST_CHECK_EQUAL(face1->getId(), face::INVALID_FACEID);
 
-  BOOST_REQUIRE_EQUAL(onRemoveHistory.size(), 1);
-  BOOST_CHECK_EQUAL(onRemoveHistory[0], onAddHistory[0]);
+  BOOST_REQUIRE_EQUAL(removeHistory.size(), 1);
+  BOOST_CHECK_EQUAL(removeHistory[0], addHistory[0]);
 }
 
 BOOST_AUTO_TEST_CASE(AddReserved)
@@ -86,7 +83,7 @@
   FaceTable& faceTable = forwarder.getFaceTable();
 
   shared_ptr<Face> face1 = make_shared<DummyFace>();
-  BOOST_CHECK_EQUAL(face1->getId(), INVALID_FACEID);
+  BOOST_CHECK_EQUAL(face1->getId(), face::INVALID_FACEID);
 
   faceTable.addReserved(face1, 5);
   BOOST_CHECK_EQUAL(face1->getId(), 5);
@@ -146,7 +143,8 @@
   BOOST_CHECK(hasFace2);
 }
 
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestFaceTable
+BOOST_AUTO_TEST_SUITE_END() // Fw
 
 } // namespace tests
 } // namespace nfd
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index 67bce49..cfa5f71 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.t.cpp
@@ -25,8 +25,6 @@
 
 #include "fw/forwarder.hpp"
 #include "tests/daemon/face/dummy-face.hpp"
-#include "tests/daemon/face/dummy-lp-face.hpp"
-#include "face/lp-face-wrapper.hpp"
 #include "dummy-strategy.hpp"
 
 #include "tests/test-common.hpp"
@@ -51,10 +49,10 @@
   interestAB->setInterestLifetime(time::seconds(4));
   shared_ptr<Data> dataABC = makeData(nameABC);
 
-  shared_ptr<DummyFace> face1 = make_shared<DummyFace>();
-  shared_ptr<DummyFace> face2 = make_shared<DummyFace>();
-  face1->afterSend.connect(afterOp);
-  face2->afterSend.connect(afterOp);
+  auto face1 = make_shared<DummyFace>();
+  auto face2 = make_shared<DummyFace>();
+  face1->afterSend.connect(bind(afterOp));
+  face2->afterSend.connect(bind(afterOp));
   forwarder.addFace(face1);
   forwarder.addFace(face2);
 
@@ -66,10 +64,10 @@
   BOOST_CHECK_EQUAL(forwarder.getCounters().nOutInterests, 0);
   g_io.post([&] { face1->receiveInterest(*interestAB); });
   BOOST_CHECK_EQUAL(limitedIo.run(1, time::seconds(1)), LimitedIo::EXCEED_OPS);
-  BOOST_REQUIRE_EQUAL(face2->m_sentInterests.size(), 1);
-  BOOST_CHECK_EQUAL(face2->m_sentInterests[0].getName(), nameAB);
-  BOOST_REQUIRE(face2->m_sentInterests[0].getTag<lp::IncomingFaceIdTag>() != nullptr);
-  BOOST_CHECK_EQUAL(*face2->m_sentInterests[0].getTag<lp::IncomingFaceIdTag>(), face1->getId());
+  BOOST_REQUIRE_EQUAL(face2->sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face2->sentInterests[0].getName(), nameAB);
+  BOOST_REQUIRE(face2->sentInterests[0].getTag<lp::IncomingFaceIdTag>() != nullptr);
+  BOOST_CHECK_EQUAL(*face2->sentInterests[0].getTag<lp::IncomingFaceIdTag>(), face1->getId());
   BOOST_CHECK_EQUAL(forwarder.getCounters().nInInterests, 1);
   BOOST_CHECK_EQUAL(forwarder.getCounters().nOutInterests, 1);
 
@@ -77,10 +75,10 @@
   BOOST_CHECK_EQUAL(forwarder.getCounters().nOutData, 0);
   g_io.post([&] { face2->receiveData(*dataABC); });
   BOOST_CHECK_EQUAL(limitedIo.run(1, time::seconds(1)), LimitedIo::EXCEED_OPS);
-  BOOST_REQUIRE_EQUAL(face1->m_sentDatas.size(), 1);
-  BOOST_CHECK_EQUAL(face1->m_sentDatas[0].getName(), nameABC);
-  BOOST_REQUIRE(face1->m_sentDatas[0].getTag<lp::IncomingFaceIdTag>() != nullptr);
-  BOOST_CHECK_EQUAL(*face1->m_sentDatas[0].getTag<lp::IncomingFaceIdTag>(), face2->getId());
+  BOOST_REQUIRE_EQUAL(face1->sentData.size(), 1);
+  BOOST_CHECK_EQUAL(face1->sentData[0].getName(), nameABC);
+  BOOST_REQUIRE(face1->sentData[0].getTag<lp::IncomingFaceIdTag>() != nullptr);
+  BOOST_CHECK_EQUAL(*face1->sentData[0].getTag<lp::IncomingFaceIdTag>(), face2->getId());
   BOOST_CHECK_EQUAL(forwarder.getCounters().nInData, 1);
   BOOST_CHECK_EQUAL(forwarder.getCounters().nOutData, 1);
 }
@@ -90,9 +88,9 @@
   LimitedIo limitedIo;
   Forwarder forwarder;
 
-  shared_ptr<DummyFace> face1 = make_shared<DummyFace>();
-  shared_ptr<DummyFace> face2 = make_shared<DummyFace>();
-  shared_ptr<DummyFace> face3 = make_shared<DummyFace>();
+  auto face1 = make_shared<DummyFace>();
+  auto face2 = make_shared<DummyFace>();
+  auto face3 = make_shared<DummyFace>();
   forwarder.addFace(face1);
   forwarder.addFace(face2);
   forwarder.addFace(face3);
@@ -115,12 +113,12 @@
   face1->receiveInterest(*interestA);
   limitedIo.run(LimitedIo::UNLIMITED_OPS, time::milliseconds(5));
   // Interest matching ContentStore should not be forwarded
-  BOOST_REQUIRE_EQUAL(face2->m_sentInterests.size(), 0);
+  BOOST_REQUIRE_EQUAL(face2->sentInterests.size(), 0);
 
-  BOOST_REQUIRE_EQUAL(face1->m_sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face1->sentData.size(), 1);
   // IncomingFaceId field should be reset to represent CS
-  BOOST_REQUIRE(face1->m_sentDatas[0].getTag<lp::IncomingFaceIdTag>() != nullptr);
-  BOOST_CHECK_EQUAL(*face1->m_sentDatas[0].getTag<lp::IncomingFaceIdTag>(), FACEID_CONTENT_STORE);
+  BOOST_REQUIRE(face1->sentData[0].getTag<lp::IncomingFaceIdTag>() != nullptr);
+  BOOST_CHECK_EQUAL(*face1->sentData[0].getTag<lp::IncomingFaceIdTag>(), face::FACEID_CONTENT_STORE);
 
   limitedIo.run(LimitedIo::UNLIMITED_OPS, time::milliseconds(500));
   // PIT entry should not be left behind
@@ -155,8 +153,8 @@
 BOOST_AUTO_TEST_CASE(ScopeLocalhostIncoming)
 {
   ScopeLocalhostIncomingTestForwarder forwarder;
-  shared_ptr<Face> face1 = make_shared<DummyLocalFace>();
-  shared_ptr<Face> face2 = make_shared<DummyFace>();
+  auto face1 = make_shared<DummyFace>("dummy://", "dummy://", ndn::nfd::FACE_SCOPE_LOCAL);
+  auto face2 = make_shared<DummyFace>();
   forwarder.addFace(face1);
   forwarder.addFace(face2);
 
@@ -212,9 +210,9 @@
 BOOST_AUTO_TEST_CASE(ScopeLocalhostOutgoing)
 {
   Forwarder forwarder;
-  shared_ptr<DummyLocalFace> face1 = make_shared<DummyLocalFace>();
-  shared_ptr<DummyFace>      face2 = make_shared<DummyFace>();
-  shared_ptr<Face>           face3 = make_shared<DummyLocalFace>();
+  auto face1 = make_shared<DummyFace>("dummy://", "dummy://", ndn::nfd::FACE_SCOPE_LOCAL);
+  auto face2 = make_shared<DummyFace>();
+  auto face3 = make_shared<DummyFace>("dummy://", "dummy://", ndn::nfd::FACE_SCOPE_LOCAL);
   forwarder.addFace(face1);
   forwarder.addFace(face2);
   forwarder.addFace(face3);
@@ -224,62 +222,62 @@
   shared_ptr<Interest> interestA1 = makeInterest("/localhost/A1");
   shared_ptr<pit::Entry> pitA1 = pit.insert(*interestA1).first;
   pitA1->insertOrUpdateInRecord(face3, *interestA1);
-  face1->m_sentInterests.clear();
+  face1->sentInterests.clear();
   forwarder.onOutgoingInterest(pitA1, *face1);
-  BOOST_CHECK_EQUAL(face1->m_sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face1->sentInterests.size(), 1);
 
   // non-local face, /localhost: violate
   shared_ptr<Interest> interestA2 = makeInterest("/localhost/A2");
   shared_ptr<pit::Entry> pitA2 = pit.insert(*interestA2).first;
   pitA2->insertOrUpdateInRecord(face3, *interestA2);
-  face2->m_sentInterests.clear();
+  face2->sentInterests.clear();
   forwarder.onOutgoingInterest(pitA2, *face2);
-  BOOST_CHECK_EQUAL(face2->m_sentInterests.size(), 0);
+  BOOST_CHECK_EQUAL(face2->sentInterests.size(), 0);
 
   // local face, non-/localhost: OK
   shared_ptr<Interest> interestA3 = makeInterest("/A3");
   shared_ptr<pit::Entry> pitA3 = pit.insert(*interestA3).first;
   pitA3->insertOrUpdateInRecord(face3, *interestA3);
-  face1->m_sentInterests.clear();
+  face1->sentInterests.clear();
   forwarder.onOutgoingInterest(pitA3, *face1);
-  BOOST_CHECK_EQUAL(face1->m_sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face1->sentInterests.size(), 1);
 
   // non-local face, non-/localhost: OK
   shared_ptr<Interest> interestA4 = makeInterest("/A4");
   shared_ptr<pit::Entry> pitA4 = pit.insert(*interestA4).first;
   pitA4->insertOrUpdateInRecord(face3, *interestA4);
-  face2->m_sentInterests.clear();
+  face2->sentInterests.clear();
   forwarder.onOutgoingInterest(pitA4, *face2);
-  BOOST_CHECK_EQUAL(face2->m_sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face2->sentInterests.size(), 1);
 
   // local face, /localhost: OK
-  face1->m_sentDatas.clear();
+  face1->sentData.clear();
   forwarder.onOutgoingData(Data("/localhost/B1"), *face1);
-  BOOST_CHECK_EQUAL(face1->m_sentDatas.size(), 1);
+  BOOST_CHECK_EQUAL(face1->sentData.size(), 1);
 
   // non-local face, /localhost: OK
-  face2->m_sentDatas.clear();
+  face2->sentData.clear();
   forwarder.onOutgoingData(Data("/localhost/B2"), *face2);
-  BOOST_CHECK_EQUAL(face2->m_sentDatas.size(), 0);
+  BOOST_CHECK_EQUAL(face2->sentData.size(), 0);
 
   // local face, non-/localhost: OK
-  face1->m_sentDatas.clear();
+  face1->sentData.clear();
   forwarder.onOutgoingData(Data("/B3"), *face1);
-  BOOST_CHECK_EQUAL(face1->m_sentDatas.size(), 1);
+  BOOST_CHECK_EQUAL(face1->sentData.size(), 1);
 
   // non-local face, non-/localhost: OK
-  face2->m_sentDatas.clear();
+  face2->sentData.clear();
   forwarder.onOutgoingData(Data("/B4"), *face2);
-  BOOST_CHECK_EQUAL(face2->m_sentDatas.size(), 1);
+  BOOST_CHECK_EQUAL(face2->sentData.size(), 1);
 }
 
 BOOST_AUTO_TEST_CASE(ScopeLocalhopOutgoing)
 {
   Forwarder forwarder;
-  shared_ptr<DummyLocalFace> face1 = make_shared<DummyLocalFace>();
-  shared_ptr<DummyFace>      face2 = make_shared<DummyFace>();
-  shared_ptr<DummyLocalFace> face3 = make_shared<DummyLocalFace>();
-  shared_ptr<DummyFace>      face4 = make_shared<DummyFace>();
+  auto face1 = make_shared<DummyFace>("dummy://", "dummy://", ndn::nfd::FACE_SCOPE_LOCAL);
+  auto face2 = make_shared<DummyFace>();
+  auto face3 = make_shared<DummyFace>("dummy://", "dummy://", ndn::nfd::FACE_SCOPE_LOCAL);
+  auto face4 = make_shared<DummyFace>();
   forwarder.addFace(face1);
   forwarder.addFace(face2);
   forwarder.addFace(face3);
@@ -290,59 +288,59 @@
   shared_ptr<Interest> interest1 = makeInterest("/localhop/1");
   shared_ptr<pit::Entry> pit1 = pit.insert(*interest1).first;
   pit1->insertOrUpdateInRecord(face1, *interest1);
-  face3->m_sentInterests.clear();
+  face3->sentInterests.clear();
   forwarder.onOutgoingInterest(pit1, *face3);
-  BOOST_CHECK_EQUAL(face3->m_sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face3->sentInterests.size(), 1);
 
   // from non-local face, to local face: OK
   shared_ptr<Interest> interest2 = makeInterest("/localhop/2");
   shared_ptr<pit::Entry> pit2 = pit.insert(*interest2).first;
   pit2->insertOrUpdateInRecord(face2, *interest2);
-  face3->m_sentInterests.clear();
+  face3->sentInterests.clear();
   forwarder.onOutgoingInterest(pit2, *face3);
-  BOOST_CHECK_EQUAL(face3->m_sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face3->sentInterests.size(), 1);
 
   // from local face, to non-local face: OK
   shared_ptr<Interest> interest3 = makeInterest("/localhop/3");
   shared_ptr<pit::Entry> pit3 = pit.insert(*interest3).first;
   pit3->insertOrUpdateInRecord(face1, *interest3);
-  face4->m_sentInterests.clear();
+  face4->sentInterests.clear();
   forwarder.onOutgoingInterest(pit3, *face4);
-  BOOST_CHECK_EQUAL(face4->m_sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face4->sentInterests.size(), 1);
 
   // from non-local face, to non-local face: violate
   shared_ptr<Interest> interest4 = makeInterest("/localhop/4");
   shared_ptr<pit::Entry> pit4 = pit.insert(*interest4).first;
   pit4->insertOrUpdateInRecord(face2, *interest4);
-  face4->m_sentInterests.clear();
+  face4->sentInterests.clear();
   forwarder.onOutgoingInterest(pit4, *face4);
-  BOOST_CHECK_EQUAL(face4->m_sentInterests.size(), 0);
+  BOOST_CHECK_EQUAL(face4->sentInterests.size(), 0);
 
   // from local face and non-local face, to local face: OK
   shared_ptr<Interest> interest5 = makeInterest("/localhop/5");
   shared_ptr<pit::Entry> pit5 = pit.insert(*interest5).first;
   pit5->insertOrUpdateInRecord(face1, *interest5);
   pit5->insertOrUpdateInRecord(face2, *interest5);
-  face3->m_sentInterests.clear();
+  face3->sentInterests.clear();
   forwarder.onOutgoingInterest(pit5, *face3);
-  BOOST_CHECK_EQUAL(face3->m_sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face3->sentInterests.size(), 1);
 
   // from local face and non-local face, to non-local face: OK
   shared_ptr<Interest> interest6 = makeInterest("/localhop/6");
   shared_ptr<pit::Entry> pit6 = pit.insert(*interest6).first;
   pit6->insertOrUpdateInRecord(face1, *interest6);
   pit6->insertOrUpdateInRecord(face2, *interest6);
-  face4->m_sentInterests.clear();
+  face4->sentInterests.clear();
   forwarder.onOutgoingInterest(pit6, *face4);
-  BOOST_CHECK_EQUAL(face4->m_sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face4->sentInterests.size(), 1);
 }
 
 BOOST_AUTO_TEST_CASE(IncomingInterestStrategyDispatch)
 {
   LimitedIo limitedIo;
   Forwarder forwarder;
-  shared_ptr<Face> face1 = make_shared<DummyFace>();
-  shared_ptr<Face> face2 = make_shared<DummyFace>();
+  auto face1 = make_shared<DummyFace>();
+  auto face2 = make_shared<DummyFace>();
   forwarder.addFace(face1);
   forwarder.addFace(face2);
 
@@ -398,10 +396,10 @@
 {
   LimitedIo limitedIo;
   Forwarder forwarder;
-  shared_ptr<DummyFace> face1 = make_shared<DummyFace>();
-  shared_ptr<DummyFace> face2 = make_shared<DummyFace>();
-  shared_ptr<DummyFace> face3 = make_shared<DummyFace>();
-  shared_ptr<DummyFace> face4 = make_shared<DummyFace>();
+  auto face1 = make_shared<DummyFace>();
+  auto face2 = make_shared<DummyFace>();
+  auto face3 = make_shared<DummyFace>();
+  auto face4 = make_shared<DummyFace>();
   forwarder.addFace(face1);
   forwarder.addFace(face2);
   forwarder.addFace(face3);
@@ -424,10 +422,10 @@
   forwarder.onIncomingData(*face3, *dataD);
   limitedIo.run(LimitedIo::UNLIMITED_OPS, time::milliseconds(5));
 
-  BOOST_CHECK_EQUAL(face1->m_sentDatas.size(), 1);
-  BOOST_CHECK_EQUAL(face2->m_sentDatas.size(), 1);
-  BOOST_CHECK_EQUAL(face3->m_sentDatas.size(), 0);
-  BOOST_CHECK_EQUAL(face4->m_sentDatas.size(), 1);
+  BOOST_CHECK_EQUAL(face1->sentData.size(), 1);
+  BOOST_CHECK_EQUAL(face2->sentData.size(), 1);
+  BOOST_CHECK_EQUAL(face3->sentData.size(), 0);
+  BOOST_CHECK_EQUAL(face4->sentData.size(), 1);
 }
 
 BOOST_AUTO_TEST_CASE(IncomingNack)
@@ -435,11 +433,10 @@
   Forwarder forwarder;
   auto face1 = make_shared<DummyFace>();
   auto face2 = make_shared<DummyFace>();
-  auto face3 = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>(
-               "dummy://", "dummy://",
-               ndn::nfd::FACE_SCOPE_NON_LOCAL,
-               ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-               ndn::nfd::LINK_TYPE_MULTI_ACCESS));
+  auto face3 = make_shared<DummyFace>("dummy://", "dummy://",
+                                      ndn::nfd::FACE_SCOPE_NON_LOCAL,
+                                      ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+                                      ndn::nfd::LINK_TYPE_MULTI_ACCESS);
   forwarder.addFace(face1);
   forwarder.addFace(face2);
   forwarder.addFace(face3);
@@ -524,20 +521,15 @@
 BOOST_AUTO_TEST_CASE(OutgoingNack)
 {
   Forwarder forwarder;
-  auto face1w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>());
-  auto face1 = static_cast<DummyLpFace*>(face1w->getLpFace());
-  auto face2w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>());
-  auto face2 = static_cast<DummyLpFace*>(face2w->getLpFace());
-  auto face3w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>(
-                "dummy://", "dummy://",
-                ndn::nfd::FACE_SCOPE_NON_LOCAL,
-                ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-                ndn::nfd::LINK_TYPE_MULTI_ACCESS));
-  auto face3 = static_cast<DummyLpFace*>(face3w->getLpFace());
-  forwarder.addFace(face1w);
-  forwarder.addFace(face2w);
-  forwarder.addFace(face3w);
-  // TODO#3172 eliminate wrapper
+  auto face1 = make_shared<DummyFace>();
+  auto face2 = make_shared<DummyFace>();
+  auto face3 = make_shared<DummyFace>("dummy://", "dummy://",
+                                      ndn::nfd::FACE_SCOPE_NON_LOCAL,
+                                      ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+                                      ndn::nfd::LINK_TYPE_MULTI_ACCESS);
+  forwarder.addFace(face1);
+  forwarder.addFace(face2);
+  forwarder.addFace(face3);
 
   Pit& pit = forwarder.getPit();
 
@@ -547,68 +539,63 @@
   // don't send Nack if there's no in-record
   shared_ptr<Interest> interest1 = makeInterest("/fM5IVEtC", 719);
   shared_ptr<pit::Entry> pit1 = pit.insert(*interest1).first;
-  pit1->insertOrUpdateInRecord(face1w, *interest1);
+  pit1->insertOrUpdateInRecord(face1, *interest1);
 
   face2->sentNacks.clear();
-  forwarder.onOutgoingNack(pit1, *face2w, nackHeader);
+  forwarder.onOutgoingNack(pit1, *face2, nackHeader);
   BOOST_CHECK_EQUAL(face2->sentNacks.size(), 0);
 
   // send Nack with correct Nonce
   shared_ptr<Interest> interest2a = makeInterest("/Vi8tRm9MG3", 152);
   shared_ptr<pit::Entry> pit2 = pit.insert(*interest2a).first;
-  pit2->insertOrUpdateInRecord(face1w, *interest2a);
+  pit2->insertOrUpdateInRecord(face1, *interest2a);
   shared_ptr<Interest> interest2b = makeInterest("/Vi8tRm9MG3", 808);
-  pit2->insertOrUpdateInRecord(face2w, *interest2b);
+  pit2->insertOrUpdateInRecord(face2, *interest2b);
 
   face1->sentNacks.clear();
-  forwarder.onOutgoingNack(pit2, *face1w, nackHeader);
+  forwarder.onOutgoingNack(pit2, *face1, nackHeader);
   BOOST_REQUIRE_EQUAL(face1->sentNacks.size(), 1);
   BOOST_CHECK_EQUAL(face1->sentNacks.back().getReason(), lp::NackReason::CONGESTION);
   BOOST_CHECK_EQUAL(face1->sentNacks.back().getInterest().getNonce(), 152);
 
   // erase in-record
-  pit::InRecordCollection::const_iterator inRecord2a = pit2->getInRecord(*face1w);
+  pit::InRecordCollection::const_iterator inRecord2a = pit2->getInRecord(*face1);
   BOOST_CHECK(inRecord2a == pit2->getInRecords().end());
 
   // send Nack with correct Nonce
   face2->sentNacks.clear();
-  forwarder.onOutgoingNack(pit2, *face2w, nackHeader);
+  forwarder.onOutgoingNack(pit2, *face2, nackHeader);
   BOOST_REQUIRE_EQUAL(face2->sentNacks.size(), 1);
   BOOST_CHECK_EQUAL(face2->sentNacks.back().getReason(), lp::NackReason::CONGESTION);
   BOOST_CHECK_EQUAL(face2->sentNacks.back().getInterest().getNonce(), 808);
 
   // erase in-record
-  pit::InRecordCollection::const_iterator inRecord2b = pit2->getInRecord(*face1w);
+  pit::InRecordCollection::const_iterator inRecord2b = pit2->getInRecord(*face1);
   BOOST_CHECK(inRecord2b == pit2->getInRecords().end());
 
   // don't send Nack to multi-access face
   shared_ptr<Interest> interest2c = makeInterest("/Vi8tRm9MG3", 228);
-  pit2->insertOrUpdateInRecord(face3w, *interest2c);
+  pit2->insertOrUpdateInRecord(face3, *interest2c);
 
   face3->sentNacks.clear();
-  forwarder.onOutgoingNack(pit1, *face3w, nackHeader);
+  forwarder.onOutgoingNack(pit1, *face3, nackHeader);
   BOOST_CHECK_EQUAL(face3->sentNacks.size(), 0);
 }
 
 BOOST_AUTO_TEST_CASE(InterestLoopNack)
 {
   Forwarder forwarder;
-  auto face1w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>());
-  auto face1 = static_cast<DummyLpFace*>(face1w->getLpFace());
-  auto face2w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>());
-  auto face2 = static_cast<DummyLpFace*>(face2w->getLpFace());
-  auto face3w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>(
-                "dummy://", "dummy://",
-                ndn::nfd::FACE_SCOPE_NON_LOCAL,
-                ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-                ndn::nfd::LINK_TYPE_MULTI_ACCESS));
-  auto face3 = static_cast<DummyLpFace*>(face3w->getLpFace());
+  auto face1 = make_shared<DummyFace>();
+  auto face2 = make_shared<DummyFace>();
+  auto face3 = make_shared<DummyFace>("dummy://", "dummy://",
+                                      ndn::nfd::FACE_SCOPE_NON_LOCAL,
+                                      ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+                                      ndn::nfd::LINK_TYPE_MULTI_ACCESS);
   auto face4 = make_shared<DummyFace>();
-  forwarder.addFace(face1w);
-  forwarder.addFace(face2w);
-  forwarder.addFace(face3w);
+  forwarder.addFace(face1);
+  forwarder.addFace(face2);
+  forwarder.addFace(face3);
   forwarder.addFace(face4);
-  // TODO#3172 eliminate wrapper
 
   Fib& fib = forwarder.getFib();
   shared_ptr<fib::Entry> fibEntry = fib.insert(Name("/zT4XwK0Hnx")).first;
@@ -658,8 +645,11 @@
   forwarder.addFace(face2);
 
   // cause an Interest sent out of face2 to loop back into face1 after a delay
-  face2->onSendInterest.connect([&face1] (const Interest& interest) {
-    scheduler::schedule(time::milliseconds(170), [&] { face1->receiveInterest(interest); });
+  face2->afterSend.connect([face1, face2] (uint32_t pktType) {
+    if (pktType == tlv::Interest) {
+      auto interest = make_shared<Interest>(face2->sentInterests.back());
+      scheduler::schedule(time::milliseconds(170), [face1, interest] { face1->receiveInterest(*interest); });
+    }
   });
 
   Fib& fib = forwarder.getFib();
@@ -676,7 +666,7 @@
   BOOST_ASSERT(time::milliseconds(25) * 40 < forwarder.getDeadNonceList().getLifetime());
   this->advanceClocks(time::milliseconds(25), 40);
 
-  BOOST_CHECK_EQUAL(face2->m_sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face2->sentInterests.size(), 1);
 
   // It's unnecessary to check that Interest with duplicate Nonce can be forwarded again
   // after it's gone from Dead Nonce List, because the entry lifetime of Dead Nonce List
diff --git a/tests/daemon/fw/strategy.t.cpp b/tests/daemon/fw/strategy.t.cpp
index 44fead2..90654d7 100644
--- a/tests/daemon/fw/strategy.t.cpp
+++ b/tests/daemon/fw/strategy.t.cpp
@@ -36,7 +36,8 @@
 
 using namespace nfd::tests;
 
-BOOST_FIXTURE_TEST_SUITE(FwStrategy, BaseFixture)
+BOOST_AUTO_TEST_SUITE(Fw)
+BOOST_FIXTURE_TEST_SUITE(TestStrategy, BaseFixture)
 
 class FaceTableAccessTestStrategy : public DummyStrategy
 {
@@ -58,7 +59,7 @@
   {
     auto enumerable = this->getFaceTable() |
                       boost::adaptors::filtered([] (shared_ptr<Face> face) {
-                        return face->isLocal();
+                        return face->getScope() == ndn::nfd::FACE_SCOPE_LOCAL;
                       });
 
     std::vector<FaceId> results;
@@ -79,7 +80,7 @@
   FaceTableAccessTestStrategy strategy(forwarder);
 
   auto face1 = make_shared<DummyFace>();
-  auto face2 = make_shared<DummyLocalFace>();
+  auto face2 = make_shared<DummyFace>("dummy://", "dummy://", ndn::nfd::FACE_SCOPE_LOCAL);
   forwarder.addFace(face1);
   forwarder.addFace(face2);
   FaceId id1 = face1->getId();
@@ -94,7 +95,8 @@
   BOOST_CHECK((strategy.removedFaces == std::vector<FaceId>{id2, id1}));
 }
 
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestStrategy
+BOOST_AUTO_TEST_SUITE_END() // Fw
 
 } // namespace tests
 } // namespace fw
diff --git a/tests/daemon/fw/topology-tester.cpp b/tests/daemon/fw/topology-tester.cpp
index 8b94abc..f1e54bb 100644
--- a/tests/daemon/fw/topology-tester.cpp
+++ b/tests/daemon/fw/topology-tester.cpp
@@ -34,7 +34,6 @@
 using face::InternalTransportBase;
 using face::InternalForwarderTransport;
 using face::InternalClientTransport;
-using face::LpFaceWrapper;
 using face::GenericLinkService;
 
 TopologyLink::TopologyLink(const time::nanoseconds& delay)
@@ -46,9 +45,9 @@
 }
 
 void
-TopologyLink::addFace(TopologyNode i, shared_ptr<LpFaceWrapper> face)
+TopologyLink::addFace(TopologyNode i, shared_ptr<Face> face)
 {
-  this->attachTransport(i, dynamic_cast<InternalTransportBase*>(face->getLpFace()->getTransport()));
+  this->attachTransport(i, dynamic_cast<InternalTransportBase*>(face->getTransport()));
   m_faces[i] = face;
 }
 
@@ -87,9 +86,9 @@
   });
 }
 
-TopologyAppLink::TopologyAppLink(shared_ptr<LpFaceWrapper> forwarderFace)
+TopologyAppLink::TopologyAppLink(shared_ptr<Face> forwarderFace)
   : m_face(forwarderFace)
-  , m_forwarderTransport(static_cast<InternalForwarderTransport*>(forwarderFace->getLpFace()->getTransport()))
+  , m_forwarderTransport(static_cast<InternalForwarderTransport*>(forwarderFace->getTransport()))
   , m_clientTransport(make_shared<InternalClientTransport>())
   , m_client(make_shared<ndn::Face>(m_clientTransport, getGlobalIoService()))
 {
@@ -136,11 +135,10 @@
     auto service = make_unique<GenericLinkService>();
     auto transport = make_unique<InternalForwarderTransport>(localUri, remoteUri,
                      ndn::nfd::FACE_SCOPE_NON_LOCAL, linkType);
-    auto face = make_unique<LpFace>(std::move(service), std::move(transport));
-    auto faceW = make_shared<LpFaceWrapper>(std::move(face));
+    auto face = make_shared<Face>(std::move(service), std::move(transport));
 
-    forwarder.addFace(faceW);
-    link->addFace(i, faceW);
+    forwarder.addFace(face);
+    link->addFace(i, face);
   }
 
   m_links.push_back(link); // keep a shared_ptr so callers don't have to
@@ -157,12 +155,11 @@
   auto service = make_unique<GenericLinkService>();
   auto transport = make_unique<InternalForwarderTransport>(localUri, remoteUri,
                    ndn::nfd::FACE_SCOPE_LOCAL, ndn::nfd::LINK_TYPE_POINT_TO_POINT);
-  auto face = make_unique<LpFace>(std::move(service), std::move(transport));
-  auto faceW = make_shared<LpFaceWrapper>(std::move(face));
+  auto face = make_shared<Face>(std::move(service), std::move(transport));
 
-  forwarder.addFace(faceW);
+  forwarder.addFace(face);
 
-  auto al = make_shared<TopologyAppLink>(faceW);
+  auto al = make_shared<TopologyAppLink>(face);
   m_appLinks.push_back(al); // keep a shared_ptr so callers don't have to
   return al;
 }
diff --git a/tests/daemon/fw/topology-tester.hpp b/tests/daemon/fw/topology-tester.hpp
index 9a10ad7..88d73da 100644
--- a/tests/daemon/fw/topology-tester.hpp
+++ b/tests/daemon/fw/topology-tester.hpp
@@ -32,7 +32,7 @@
 
 #include <ndn-cxx/face.hpp>
 #include "face/internal-transport.hpp"
-#include "face/lp-face-wrapper.hpp"
+#include "face/face.hpp"
 #include "fw/strategy.hpp"
 #include "tests/test-common.hpp"
 
@@ -70,8 +70,12 @@
     m_isUp = true;
   }
 
+  /** \brief attach a face to the link
+   *  \param i forwarder index
+   *  \param face a Face with InternalForwarderTransport
+   */
   void
-  addFace(TopologyNode i, shared_ptr<face::LpFaceWrapper> face);
+  addFace(TopologyNode i, shared_ptr<Face> face);
 
   /** \return a face of forwarder \p i which is attached to this link
    */
@@ -98,7 +102,7 @@
   bool m_isUp;
   time::nanoseconds m_delay;
   std::unordered_map<TopologyNode, face::InternalTransportBase*> m_transports;
-  std::unordered_map<TopologyNode, shared_ptr<face::LpFaceWrapper>> m_faces;
+  std::unordered_map<TopologyNode, shared_ptr<Face>> m_faces;
 };
 
 /** \brief represents a link to a local application
@@ -106,8 +110,11 @@
 class TopologyAppLink : noncopyable
 {
 public:
+  /** \brief constructor
+   *  \param forwarderFace a Face with InternalForwarderTransport
+   */
   explicit
-  TopologyAppLink(shared_ptr<face::LpFaceWrapper> forwarderFace);
+  TopologyAppLink(shared_ptr<Face> forwarderFace);
 
   /** \brief fail the link, cause packets to be dropped silently
    */
diff --git a/tests/daemon/mgmt/face-manager.t.cpp b/tests/daemon/mgmt/face-manager.t.cpp
index 02bcd78..a8f3015 100644
--- a/tests/daemon/mgmt/face-manager.t.cpp
+++ b/tests/daemon/mgmt/face-manager.t.cpp
@@ -37,6 +37,9 @@
 namespace nfd {
 namespace tests {
 
+BOOST_AUTO_TEST_SUITE(Mgmt)
+
+
 class FaceManagerFixture : public ManagerCommonFixture
 {
 public:
@@ -48,32 +51,74 @@
   }
 
 public:
-  template<typename Face>
+  enum AddFaceFlags {
+    REMOVE_LAST_NOTIFICATION = 1 << 0,
+    SET_SCOPE_LOCAL          = 1 << 1,
+    SET_URI_TEST             = 1 << 2,
+    RANDOMIZE_COUNTERS       = 1 << 3
+  };
+
+  /** \brief adds a face to the FaceTable
+   *  \param options bitwise OR'ed AddFaceFlags
+   */
   shared_ptr<Face>
-  addFace(bool wantRemoveLastNotification = false)
+  addFace(int flags = 0)
   {
-    auto face = make_shared<Face>();
+    std::string uri = "dummy://";
+    ndn::nfd::FaceScope scope = ndn::nfd::FACE_SCOPE_NON_LOCAL;
+
+    if ((flags & SET_SCOPE_LOCAL) != 0) {
+      scope = ndn::nfd::FACE_SCOPE_LOCAL;
+    }
+    if ((flags & SET_URI_TEST) != 0) {
+      uri = "test://";
+    }
+
+    auto face = make_shared<DummyFace>(uri, uri, scope);
     m_faceTable.add(face);
+
+    if ((flags & RANDOMIZE_COUNTERS) != 0) {
+      const face::FaceCounters& counters = face->getCounters();
+      randomizeCounter(counters.nInInterests);
+      randomizeCounter(counters.nOutInterests);
+      randomizeCounter(counters.nInData);
+      randomizeCounter(counters.nOutData);
+      randomizeCounter(counters.nInNacks);
+      randomizeCounter(counters.nOutNacks);
+      randomizeCounter(counters.nInPackets);
+      randomizeCounter(counters.nOutPackets);
+      randomizeCounter(counters.nInBytes);
+      randomizeCounter(counters.nOutBytes);
+    }
+
     advanceClocks(time::milliseconds(1), 10); // wait for notification posted
-    if (wantRemoveLastNotification) {
+    if ((flags & REMOVE_LAST_NOTIFICATION) != 0) {
       m_responses.pop_back();
     }
+
     return face;
   }
 
+private:
+  template<typename T>
+  static typename std::enable_if<std::is_base_of<SimpleCounter, T>::value>::type
+  randomizeCounter(const T& counter)
+  {
+    const_cast<T&>(counter).set(ndn::random::generateWord64());
+  }
+
 protected:
   FaceTable& m_faceTable;
   FaceManager m_manager;
 };
 
-BOOST_FIXTURE_TEST_SUITE(Mgmt, FaceManagerFixture)
-BOOST_AUTO_TEST_SUITE(TestFaceManager)
+BOOST_FIXTURE_TEST_SUITE(TestFaceManager, FaceManagerFixture)
 
 BOOST_AUTO_TEST_SUITE(DestroyFace)
 
 BOOST_AUTO_TEST_CASE(Existing)
 {
-  auto addedFace = addFace<DummyFace>(true); // clear notification for creation
+  auto addedFace = addFace(REMOVE_LAST_NOTIFICATION | SET_SCOPE_LOCAL); // clear notification for creation
 
   auto parameters = ControlParameters().setFaceId(addedFace->getId());
   auto command = makeControlCommandRequest("/localhost/nfd/faces/destroy", parameters);
@@ -86,7 +131,7 @@
   BOOST_CHECK_EQUAL(checkResponse(1, command->getName(), makeResponse(200, "OK", parameters)),
                     CheckResponseResult::OK);
 
-  BOOST_CHECK_EQUAL(addedFace->getId(), -1);
+  BOOST_CHECK_EQUAL(addedFace->getId(), face::INVALID_FACEID);
 }
 
 BOOST_AUTO_TEST_CASE(NonExisting)
@@ -106,7 +151,7 @@
 
 BOOST_AUTO_TEST_CASE(FaceEvents)
 {
-  auto addedFace = addFace<DummyFace>(); // trigger FACE_EVENT_CREATED notification
+  auto addedFace = addFace(); // trigger FACE_EVENT_CREATED notification
   BOOST_CHECK_NE(addedFace->getId(), -1);
   int64_t faceId = addedFace->getId();
 
@@ -146,25 +191,9 @@
     BOOST_CHECK_EQUAL(notification.getFacePersistency(), ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
     BOOST_CHECK_EQUAL(notification.getLinkType(), ndn::nfd::LinkType::LINK_TYPE_POINT_TO_POINT);
   }
-  BOOST_CHECK_EQUAL(addedFace->getId(), -1);
+  BOOST_CHECK_EQUAL(addedFace->getId(), face::INVALID_FACEID);
 }
 
-class TestFace : public DummyFace
-{
-public:
-  explicit
-  TestFace(const std::string& uri = "test://")
-    : DummyFace(uri, uri)
-  {
-    getMutableCounters().getNInInterests().set(ndn::random::generateWord64());
-    getMutableCounters().getNInDatas().set(ndn::random::generateWord64());
-    getMutableCounters().getNOutInterests().set(ndn::random::generateWord64());
-    getMutableCounters().getNOutDatas().set(ndn::random::generateWord64());
-    getMutableCounters().getNInBytes().set(ndn::random::generateWord64());
-    getMutableCounters().getNOutBytes().set(ndn::random::generateWord64());
-  }
-};
-
 // @todo Refactor when ndn::nfd::FaceStatus implementes operator!= and operator<<
 class FaceStatus : public ndn::nfd::FaceStatus
 {
@@ -179,16 +208,16 @@
 operator!=(const FaceStatus& left, const FaceStatus& right)
 {
   return left.getRemoteUri() != right.getRemoteUri() ||
-    left.getLocalUri() != right.getLocalUri() ||
-    left.getFaceScope() != right.getFaceScope() ||
-    left.getFacePersistency() != right.getFacePersistency() ||
-    left.getLinkType() != right.getLinkType() ||
-    left.getNInInterests() != right.getNInInterests() ||
-    left.getNInDatas() != right.getNInDatas() ||
-    left.getNOutInterests() != right.getNOutInterests() ||
-    left.getNOutDatas() != right.getNOutDatas() ||
-    left.getNInBytes() != right.getNInBytes() ||
-    left.getNOutBytes() != right.getNOutBytes();
+         left.getLocalUri() != right.getLocalUri() ||
+         left.getFaceScope() != right.getFaceScope() ||
+         left.getFacePersistency() != right.getFacePersistency() ||
+         left.getLinkType() != right.getLinkType() ||
+         left.getNInInterests() != right.getNInInterests() ||
+         left.getNInDatas() != right.getNInDatas() ||
+         left.getNOutInterests() != right.getNOutInterests() ||
+         left.getNOutDatas() != right.getNOutDatas() ||
+         left.getNInBytes() != right.getNInBytes() ||
+         left.getNOutBytes() != right.getNOutBytes();
 }
 
 std::ostream&
@@ -210,8 +239,8 @@
 BOOST_AUTO_TEST_CASE(FaceDataset)
 {
   size_t nEntries = 303;
-  for (size_t i = 0 ; i < nEntries ; i ++) {
-    addFace<TestFace>(true);
+  for (size_t i = 0; i < nEntries; ++i) {
+    addFace(REMOVE_LAST_NOTIFICATION | SET_URI_TEST | RANDOMIZE_COUNTERS);
   }
 
   receiveInterest(makeInterest("/localhost/nfd/faces/list"));
@@ -237,9 +266,9 @@
 
 BOOST_AUTO_TEST_CASE(FaceQuery)
 {
-  auto face1 = addFace<DummyFace>(true); // dummy://
-  auto face2 = addFace<DummyLocalFace>(true); // dummy://, local
-  auto face3 = addFace<TestFace>(true); // test://
+  auto face1 = addFace(REMOVE_LAST_NOTIFICATION); // dummy://
+  auto face2 = addFace(REMOVE_LAST_NOTIFICATION | SET_SCOPE_LOCAL); // dummy://, local
+  auto face3 = addFace(REMOVE_LAST_NOTIFICATION | SET_URI_TEST); // test://
 
   auto generateQueryName = [] (const ndn::nfd::FaceQueryFilter& filter) {
     return Name("/localhost/nfd/faces/query").append(filter.wireEncode());
diff --git a/tests/daemon/mgmt/fib-manager.t.cpp b/tests/daemon/mgmt/fib-manager.t.cpp
index 945a07e..87856ed 100644
--- a/tests/daemon/mgmt/fib-manager.t.cpp
+++ b/tests/daemon/mgmt/fib-manager.t.cpp
@@ -80,7 +80,7 @@
    * @brief check whether the nexthop record is added / removed properly
    *
    * @param expectedNNextHops use -1 to skip this check
-   * @param faceId use FACEID_NULL to skip NextHopRecord checks
+   * @param faceId use face::FACEID_NULL to skip NextHopRecord checks
    * @param expectedCost use -1 to skip this check
    *
    * @retval OK FIB entry is found by exact match and has the expected number of nexthops;
@@ -92,7 +92,7 @@
    */
   CheckNextHopResult
   checkNextHop(const Name& prefix, ssize_t expectedNNextHops = -1,
-               FaceId faceId = FACEID_NULL, int32_t expectedCost = -1)
+               FaceId faceId = face::FACEID_NULL, int32_t expectedCost = -1)
   {
     auto entry = m_fib.findExactMatch(prefix);
     if (!static_cast<bool>(entry)) {
@@ -104,7 +104,7 @@
       return CheckNextHopResult::WRONG_N_NEXTHOPS;
     }
 
-    if (faceId != FACEID_NULL) {
+    if (faceId != face::FACEID_NULL) {
       for (auto&& record : nextHops) {
         if (record.getFace()->getId() == faceId) {
           return expectedCost != -1 && record.getCost() != static_cast<uint32_t>(expectedCost) ?
@@ -158,7 +158,7 @@
 BOOST_AUTO_TEST_CASE(UnknownFaceId)
 {
   auto command = makeControlCommandRequest("/localhost/nfd/fib/add-nexthop",
-                                           makeParameters("hello", FACEID_NULL, 101));
+                                           makeParameters("hello", face::FACEID_NULL, 101));
   receiveInterest(command);
   BOOST_REQUIRE_EQUAL(m_responses.size(), 1);
 
@@ -167,14 +167,15 @@
                     CheckResponseResult::OK);
 
   // double check that the next hop was not added
-  BOOST_CHECK_EQUAL(checkNextHop("/hello", -1, FACEID_NULL, 101), CheckNextHopResult::NO_FIB_ENTRY);
+  BOOST_CHECK_EQUAL(checkNextHop("/hello", -1, face::FACEID_NULL, 101), CheckNextHopResult::NO_FIB_ENTRY);
 }
 
 BOOST_AUTO_TEST_CASE(ImplicitFaceId)
 {
   auto face1 = addFace();
   auto face2 = addFace();
-  BOOST_REQUIRE(face1 != INVALID_FACEID && face2 != INVALID_FACEID);
+  BOOST_REQUIRE_NE(face1, face::INVALID_FACEID);
+  BOOST_REQUIRE_NE(face2, face::INVALID_FACEID);
 
   Name expectedName;
   ControlResponse expectedResponse;
@@ -203,7 +204,7 @@
 BOOST_AUTO_TEST_CASE(InitialAdd)
 {
   FaceId addedFaceId = addFace();
-  BOOST_REQUIRE(addedFaceId != INVALID_FACEID);
+  BOOST_REQUIRE_NE(addedFaceId, face::INVALID_FACEID);
 
   auto parameters = makeParameters("hello", addedFaceId, 101);
   auto command = makeControlCommandRequest("/localhost/nfd/fib/add-nexthop", parameters);
@@ -218,7 +219,7 @@
 BOOST_AUTO_TEST_CASE(ImplicitCost)
 {
   FaceId addedFaceId = addFace();
-  BOOST_REQUIRE(addedFaceId != INVALID_FACEID);
+  BOOST_REQUIRE_NE(addedFaceId, face::INVALID_FACEID);
 
   auto originalParameters = ControlParameters().setName("/hello").setFaceId(addedFaceId);
   auto parameters = makeParameters("/hello", addedFaceId, 0);
@@ -234,7 +235,7 @@
 BOOST_AUTO_TEST_CASE(AddToExisting)
 {
   FaceId face = addFace();
-  BOOST_CHECK(face != INVALID_FACEID);
+  BOOST_REQUIRE_NE(face, face::INVALID_FACEID);
 
   Name expectedName;
   ControlResponse expectedResponse;
@@ -280,7 +281,9 @@
   FaceId face1 = addFace();
   FaceId face2 = addFace();
   FaceId face3 = addFace();
-  BOOST_REQUIRE(face1 != INVALID_FACEID && face2 != INVALID_FACEID && face3 != INVALID_FACEID);
+  BOOST_REQUIRE_NE(face1, face::INVALID_FACEID);
+  BOOST_REQUIRE_NE(face2, face::INVALID_FACEID);
+  BOOST_REQUIRE_NE(face3, face::INVALID_FACEID);
 
   shared_ptr<fib::Entry> entry = m_fib.insert("/hello").first;
   entry->addNextHop(m_faceTable.get(face1), 101);
@@ -306,7 +309,7 @@
 BOOST_AUTO_TEST_CASE(PrefixNotFound)
 {
   FaceId addedFaceId = addFace();
-  BOOST_CHECK(addedFaceId != INVALID_FACEID);
+  BOOST_REQUIRE_NE(addedFaceId, face::INVALID_FACEID);
 
   auto parameters = makeParameters("hello", addedFaceId);
   auto command = makeControlCommandRequest("/localhost/nfd/fib/remove-nexthop", parameters);
@@ -321,7 +324,8 @@
 {
   auto face1 = addFace();
   auto face2 = addFace();
-  BOOST_REQUIRE(face1 != INVALID_FACEID && face2 != INVALID_FACEID);
+  BOOST_REQUIRE_NE(face1, face::INVALID_FACEID);
+  BOOST_REQUIRE_NE(face2, face::INVALID_FACEID);
 
   Name expectedName;
   ControlResponse expectedResponse;
@@ -355,7 +359,8 @@
 {
   auto face1 = addFace();
   auto face2 = addFace();
-  BOOST_REQUIRE(face1 != INVALID_FACEID && face2 != INVALID_FACEID);
+  BOOST_REQUIRE_NE(face1, face::INVALID_FACEID);
+  BOOST_REQUIRE_NE(face2, face::INVALID_FACEID);
 
   Name expectedName;
   ControlResponse expectedResponse;
