diff --git a/daemon/face/internal-client-face.cpp b/daemon/face/internal-client-face.cpp
deleted file mode 100644
index 510b087..0000000
--- a/daemon/face/internal-client-face.cpp
+++ /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/>.
- */
-
-#include "internal-client-face.hpp"
-#include "internal-face.hpp"
-#include "core/global-io.hpp"
-
-#include <ndn-cxx/management/nfd-local-control-header.hpp>
-
-namespace nfd {
-
-void
-InternalClientFace::Transport::receive(const Block& block)
-{
-  if (m_receiveCallback) {
-    m_receiveCallback(block);
-  }
-}
-
-void
-InternalClientFace::Transport::close()
-{
-}
-
-void
-InternalClientFace::Transport::send(const Block& wire)
-{
-  onSendBlock(wire);
-}
-
-void
-InternalClientFace::Transport::send(const Block& header, const Block& payload)
-{
-  ndn::EncodingBuffer encoder(header.size() + payload.size(), header.size() + payload.size());
-  encoder.appendByteArray(header.wire(), header.size());
-  encoder.appendByteArray(payload.wire(), payload.size());
-
-  this->send(encoder.block());
-}
-
-void
-InternalClientFace::Transport::pause()
-{
-}
-
-void
-InternalClientFace::Transport::resume()
-{
-}
-
-InternalClientFace::InternalClientFace(const shared_ptr<InternalFace>& face,
-                                       const shared_ptr<InternalClientFace::Transport>& transport,
-                                       ndn::KeyChain& keyChain)
-  : ndn::Face(transport, getGlobalIoService(), keyChain)
-  , m_face(face)
-  , m_transport(transport)
-{
-  construct();
-}
-
-void
-InternalClientFace::construct()
-{
-  m_face->onSendInterest.connect(bind(&InternalClientFace::receive<Interest>, this, _1));
-  m_face->onSendData.connect(bind(&InternalClientFace::receive<Data>, this, _1));
-  m_transport->onSendBlock.connect(bind(&InternalFace::receive, m_face, _1));
-}
-
-shared_ptr<InternalClientFace>
-makeInternalClientFace(const shared_ptr<InternalFace>& face,
-                       ndn::KeyChain& keyChain)
-{
-  auto transport = make_shared<InternalClientFace::Transport>();
-  return shared_ptr<InternalClientFace>(new InternalClientFace(face, transport, keyChain));
-}
-
-} // namespace nfd
diff --git a/daemon/face/internal-client-face.hpp b/daemon/face/internal-client-face.hpp
deleted file mode 100644
index abc375b..0000000
--- a/daemon/face/internal-client-face.hpp
+++ /dev/null
@@ -1,116 +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_INTERNAL_CLIENT_FACE_HPP
-#define NFD_DAEMON_FACE_INTERNAL_CLIENT_FACE_HPP
-
-#include "common.hpp"
-
-#include <ndn-cxx/face.hpp>
-#include <ndn-cxx/security/key-chain.hpp>
-#include <ndn-cxx/transport/transport.hpp>
-#include <ndn-cxx/lp/packet.hpp>
-
-namespace nfd {
-
-class InternalFace;
-class InternalClientFace;
-
-shared_ptr<InternalClientFace>
-makeInternalClientFace(const shared_ptr<InternalFace>& face, ndn::KeyChain& keyChain);
-
-/** \brief a client face that is connected to NFD InternalFace
- */
-class InternalClientFace : public ndn::Face
-{
-public:
-  template<typename Packet>
-  void
-  receive(const Packet& packet);
-
-private:
-  class Transport : public ndn::Transport
-  {
-  public:
-    signal::Signal<Transport, Block> onSendBlock;
-
-    void
-    receive(const Block& block);
-
-    virtual void
-    close() DECL_OVERRIDE;
-
-    virtual void
-    send(const Block& wire) DECL_OVERRIDE;
-
-    virtual void
-    send(const Block& header, const Block& payload) DECL_OVERRIDE;
-
-    virtual void
-    pause() DECL_OVERRIDE;
-
-    virtual void
-    resume() DECL_OVERRIDE;
-  };
-
-private:
-  InternalClientFace(const shared_ptr<InternalFace>& face,
-                     const shared_ptr<InternalClientFace::Transport>& transport,
-                     ndn::KeyChain& keyChain);
-
-  void
-  construct();
-
-  friend shared_ptr<InternalClientFace>
-  makeInternalClientFace(const shared_ptr<InternalFace>& face,
-                         ndn::KeyChain& keyChain);
-
-private:
-  shared_ptr<InternalFace> m_face;
-  shared_ptr<InternalClientFace::Transport> m_transport;
-};
-
-template<typename Packet>
-void
-InternalClientFace::receive(const Packet& packet)
-{
-  lp::Packet lpPacket(packet.wireEncode());
-
-  ndn::nfd::LocalControlHeader localControlHeader = packet.getLocalControlHeader();
-
-  if (localControlHeader.hasIncomingFaceId()) {
-    lpPacket.add<lp::IncomingFaceIdField>(localControlHeader.getIncomingFaceId());
-  }
-
-  if (localControlHeader.hasNextHopFaceId()) {
-    lpPacket.add<lp::NextHopFaceIdField>(localControlHeader.getNextHopFaceId());
-  }
-
-  m_transport->receive(lpPacket.wireEncode());
-}
-
-} // namespace nfd
-
-#endif // NFD_DAEMON_FACE_INTERNAL_CLIENT_FACE_HPP
diff --git a/daemon/face/internal-face.cpp b/daemon/face/internal-face.cpp
index c5ab2ca..c89f87f 100644
--- a/daemon/face/internal-face.cpp
+++ b/daemon/face/internal-face.cpp
@@ -24,70 +24,34 @@
  */
 
 #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 {
+namespace face {
 
-InternalFace::InternalFace()
-  : Face(FaceUri("internal://"), FaceUri("internal://"), true)
+std::tuple<shared_ptr<Face>, shared_ptr<ndn::Face>>
+makeInternalFace(ndn::KeyChain& clientKeyChain)
 {
+  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
+
+  InternalForwarderTransport* forwarderTransport =
+    static_cast<InternalForwarderTransport*>(faceW->getLpFace()->getTransport());
+  auto clientTransport = make_shared<InternalClientTransport>();
+  clientTransport->connectToForwarder(forwarderTransport);
+
+  auto clientFace = make_shared<ndn::Face>(clientTransport, getGlobalIoService(), clientKeyChain);
+
+  return std::make_tuple(faceW, clientFace);
 }
 
-void
-InternalFace::sendInterest(const Interest& interest)
-{
-  this->emitSignal(onSendInterest, interest);
-}
-
-void
-InternalFace::sendData(const Data& data)
-{
-  this->emitSignal(onSendData, data);
-}
-
-void
-InternalFace::close()
-{
-}
-
-void
-InternalFace::receive(const Block& blockFromClient)
-{
-  const Block& payLoad = ndn::nfd::LocalControlHeader::getPayload(blockFromClient);
-  if (payLoad.type() == ndn::tlv::Interest) {
-    receiveInterest(*extractPacketFromBlock<Interest>(blockFromClient, payLoad));
-  }
-  else if (payLoad.type() == ndn::tlv::Data) {
-    receiveData(*extractPacketFromBlock<Data>(blockFromClient, payLoad));
-  }
-}
-
-void
-InternalFace::receiveInterest(const Interest& interest)
-{
-  this->emitSignal(onReceiveInterest, interest);
-}
-
-void
-InternalFace::receiveData(const Data& data)
-{
-  this->emitSignal(onReceiveData, data);
-}
-
-template<typename Packet>
-shared_ptr<Packet>
-InternalFace::extractPacketFromBlock(const Block& blockFromClient, const Block& payLoad)
-{
-  auto packet = make_shared<Packet>(payLoad);
-  if (&payLoad != &blockFromClient) {
-    packet->getLocalControlHeader().wireDecode(blockFromClient);
-  }
-  return packet;
-}
-
-template shared_ptr<Interest>
-InternalFace::extractPacketFromBlock<Interest>(const Block& blockFromClient, const Block& payLoad);
-
-template shared_ptr<Data>
-InternalFace::extractPacketFromBlock<Data>(const Block& blockFromClient, const Block& payLoad);
-
+} // namespace face
 } // namespace nfd
diff --git a/daemon/face/internal-face.hpp b/daemon/face/internal-face.hpp
index 1014fca..94e1960 100644
--- a/daemon/face/internal-face.hpp
+++ b/daemon/face/internal-face.hpp
@@ -27,76 +27,25 @@
 #define NFD_DAEMON_FACE_INTERNAL_FACE_HPP
 
 #include "face.hpp"
+#include <ndn-cxx/face.hpp>
 
 namespace nfd {
+namespace face {
 
-/**
- * @brief represents a face for internal use in NFD.
+/** \brief make a pair of forwarder-side face and client-side face
+ *         that are connected with each other
+ *
+ *  Network-layer packets sent by one face will be received by the other face
+ *  after io.poll().
+ *
+ *  \param clientKeyChain A KeyChain used by client-side face to sign
+ *                        prefix registration commands.
+ *  \return a forwarder-side face and a client-side face connected with each other
  */
-class InternalFace : public Face
-{
-public:
+std::tuple<shared_ptr<Face>, shared_ptr<ndn::Face>>
+makeInternalFace(ndn::KeyChain& clientKeyChain);
 
-  InternalFace();
-
-  virtual void
-  sendInterest(const Interest& interest) DECL_OVERRIDE;
-
-  virtual void
-  sendData(const Data& data) DECL_OVERRIDE;
-
-  virtual void
-  close() DECL_OVERRIDE;
-
-  /**
-   * @brief receive a block from a client face
-   *
-   * step1. extracte the packet payload from the received block.
-   * step2. check the type (either Interest or Data) through the payload.
-   * step3. call receiveInterest / receiveData respectively according to the type.
-   *
-   * @param blockFromClient the block from a client face
-   */
-  void
-  receive(const Block& blockFromClient);
-
-  /**
-   * @brief receive an Interest from a client face
-   *
-   * emit the onReceiveInterest signal.
-   *
-   * @param interest the received Interest packet
-   */
-  void
-  receiveInterest(const Interest& interest);
-
-  /**
-   * @brief receive a Data from a client face
-   *
-   * emit the onReceiveData signal.
-   *
-   * @param data the received Data packet
-   */
-  void
-  receiveData(const Data& data);
-
-  /**
-   * @brief compose the whole packet from the received block after payload is extracted
-   *
-   * construct a packet from the extracted payload, and then decode the localControlHeader if the
-   * received block holds more information than the payload.
-   *
-   * @tparam Packet the type of packet, Interest or Data
-   * @param blockFromClient the received block
-   * @param payLoad the extracted payload
-   *
-   * @return a complete packet
-   */
-  template<typename Packet>
-  static shared_ptr<Packet>
-  extractPacketFromBlock(const Block& blockFromClient, const Block& payLoad);
-};
-
+} // namespace face
 } // namespace nfd
 
 #endif // NFD_DAEMON_FACE_INTERNAL_FACE_HPP
diff --git a/daemon/face/internal-transport.cpp b/daemon/face/internal-transport.cpp
new file mode 100644
index 0000000..d9dc238
--- /dev/null
+++ b/daemon/face/internal-transport.cpp
@@ -0,0 +1,129 @@
+/* -*- 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 "internal-transport.hpp"
+#include "core/global-io.hpp"
+
+namespace nfd {
+namespace face {
+
+NFD_LOG_INCLASS_DEFINE(InternalForwarderTransport, "InternalForwarderTransport");
+
+InternalForwarderTransport::InternalForwarderTransport(
+    const FaceUri& localUri, const FaceUri& remoteUri,
+    ndn::nfd::FaceScope scope, ndn::nfd::LinkType linkType)
+{
+  this->setLocalUri(localUri);
+  this->setRemoteUri(remoteUri);
+  this->setScope(scope);
+  this->setPersistency(ndn::nfd::FACE_PERSISTENCY_PERMANENT);
+  this->setLinkType(linkType);
+
+  NFD_LOG_FACE_INFO("Creating transport");
+}
+
+void
+InternalForwarderTransport::receiveFromLink(const Block& packet)
+{
+  NFD_LOG_FACE_TRACE(__func__);
+
+  Packet p;
+  p.packet = packet;
+  this->receive(std::move(p));
+}
+
+void
+InternalForwarderTransport::doSend(Packet&& packet)
+{
+  NFD_LOG_FACE_TRACE(__func__);
+
+  this->emitSignal(afterSend, packet.packet);
+}
+
+void
+InternalForwarderTransport::doClose()
+{
+  NFD_LOG_FACE_TRACE(__func__);
+
+  this->setState(TransportState::CLOSED);
+}
+
+NFD_LOG_INCLASS_DEFINE(InternalClientTransport, "InternalClientTransport");
+
+static void
+asyncReceive(InternalTransportBase* recipient, const Block& packet)
+{
+  getGlobalIoService().post([packet, recipient] {
+    recipient->receiveFromLink(packet);
+  });
+}
+
+void
+InternalClientTransport::connectToForwarder(InternalForwarderTransport* forwarderTransport)
+{
+  NFD_LOG_DEBUG(__func__ << " " << forwarderTransport);
+
+  m_fwToClientTransmitConn.disconnect();
+  m_clientToFwTransmitConn.disconnect();
+  m_fwTransportStateConn.disconnect();
+
+  if (forwarderTransport != nullptr) {
+    m_fwToClientTransmitConn = forwarderTransport->afterSend.connect(bind(&asyncReceive, this, _1));
+    m_clientToFwTransmitConn = this->afterSend.connect(bind(&asyncReceive, forwarderTransport, _1));
+    m_fwTransportStateConn = forwarderTransport->afterStateChange.connect(
+      [this] (TransportState oldState, TransportState newState) {
+        if (newState == TransportState::CLOSED) {
+          this->connectToForwarder(nullptr);
+        }
+      });
+  }
+}
+
+void
+InternalClientTransport::receiveFromLink(const Block& packet)
+{
+  if (m_receiveCallback) {
+    m_receiveCallback(packet);
+  }
+}
+
+void
+InternalClientTransport::send(const Block& wire)
+{
+  this->emitSignal(afterSend, wire);
+}
+
+void
+InternalClientTransport::send(const Block& header, const Block& payload)
+{
+  ndn::EncodingBuffer encoder(header.size() + payload.size(), header.size() + payload.size());
+  encoder.appendByteArray(header.wire(), header.size());
+  encoder.appendByteArray(payload.wire(), payload.size());
+
+  this->send(encoder.block());
+}
+
+} // namespace face
+} // namespace nfd
diff --git a/daemon/face/internal-transport.hpp b/daemon/face/internal-transport.hpp
new file mode 100644
index 0000000..a282638
--- /dev/null
+++ b/daemon/face/internal-transport.hpp
@@ -0,0 +1,127 @@
+/* -*- 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_INTERNAL_TRANSPORT_HPP
+#define NFD_DAEMON_FACE_INTERNAL_TRANSPORT_HPP
+
+#include "transport.hpp"
+#include <ndn-cxx/transport/transport.hpp>
+
+namespace nfd {
+namespace face {
+
+/** \brief abstracts a transport that can be paired with another
+ */
+class InternalTransportBase
+{
+public:
+  /** \brief causes the transport to receive a link-layer packet
+   */
+  virtual void
+  receiveFromLink(const Block& packet) = 0;
+
+  signal::Signal<InternalTransportBase, Block> afterSend;
+
+protected:
+  DECLARE_SIGNAL_EMIT(afterSend)
+};
+
+/** \brief implements a forwarder-side transport that can be paired with another
+ */
+class InternalForwarderTransport : public face::Transport, public InternalTransportBase
+{
+public:
+  InternalForwarderTransport(const FaceUri& localUri = FaceUri("internal://"),
+                             const FaceUri& remoteUri = FaceUri("internal://"),
+                             ndn::nfd::FaceScope scope = ndn::nfd::FACE_SCOPE_LOCAL,
+                             ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_POINT_TO_POINT);
+
+  virtual void
+  receiveFromLink(const Block& packet) DECL_OVERRIDE;
+
+protected:
+  virtual void
+  doClose() DECL_OVERRIDE;
+
+private:
+  virtual void
+  doSend(Packet&& packet) DECL_OVERRIDE;
+
+private:
+  NFD_LOG_INCLASS_DECLARE();
+};
+
+/** \brief implements a client-side transport that can be paired with another
+ */
+class InternalClientTransport : public ndn::Transport, public InternalTransportBase
+{
+public:
+  /** \brief connect to a forwarder-side transport
+   *  \param forwarderTransport the forwarder-side transport to connect to; may be nullptr
+   *
+   *  The connected forwarder-side transport will be disconnected automatically if this method
+   *  is called again, or if that transport is closed.
+   *  It's safe to use InternalClientTransport without a connected forwarder-side transport:
+   *  all sent packets would be lost, and nothing would be received.
+   */
+  void
+  connectToForwarder(InternalForwarderTransport* forwarderTransport);
+
+  virtual void
+  receiveFromLink(const Block& packet) DECL_OVERRIDE;
+
+  virtual void
+  close() DECL_OVERRIDE
+  {
+  }
+
+  virtual void
+  pause() DECL_OVERRIDE
+  {
+  }
+
+  virtual void
+  resume() DECL_OVERRIDE
+  {
+  }
+
+  virtual void
+  send(const Block& wire) DECL_OVERRIDE;
+
+  virtual void
+  send(const Block& header, const Block& payload) DECL_OVERRIDE;
+
+private:
+  NFD_LOG_INCLASS_DECLARE();
+
+  signal::ScopedConnection m_fwToClientTransmitConn;
+  signal::ScopedConnection m_clientToFwTransmitConn;
+  signal::ScopedConnection m_fwTransportStateConn;
+};
+
+} // namespace face
+} // namespace nfd
+
+#endif // NFD_DAEMON_FACE_INTERNAL_TRANSPORT_HPP
diff --git a/daemon/mgmt/app-face.hpp b/daemon/mgmt/app-face.hpp
deleted file mode 100644
index 13442a8..0000000
--- a/daemon/mgmt/app-face.hpp
+++ /dev/null
@@ -1,53 +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_DAEMON_MGMT_APP_FACE_HPP
-#define NFD_DAEMON_MGMT_APP_FACE_HPP
-
-#include "common.hpp"
-
-#include <ndn-cxx/security/key-chain.hpp>
-
-namespace nfd {
-
-typedef function<void(const Name&, const Interest&)> OnInterest;
-
-class AppFace
-{
-public:
-  virtual void
-  setInterestFilter(const Name& filter,
-                    OnInterest onInterest) = 0;
-
-  virtual void
-  put(const Data& data) = 0;
-
-  virtual
-  ~AppFace() { }
-};
-
-} // namespace nfd
-
-#endif // NFD_DAEMON_MGMT_APP_FACE_HPP
diff --git a/daemon/nfd.cpp b/daemon/nfd.cpp
index 44b0579..2676a3a 100644
--- a/daemon/nfd.cpp
+++ b/daemon/nfd.cpp
@@ -32,7 +32,6 @@
 #include "fw/forwarder.hpp"
 #include "face/null-face.hpp"
 #include "face/internal-face.hpp"
-#include "face/internal-client-face.hpp"
 #include "mgmt/fib-manager.hpp"
 #include "mgmt/face-manager.hpp"
 #include "mgmt/strategy-choice-manager.hpp"
@@ -145,9 +144,8 @@
 void
 Nfd::initializeManagement()
 {
-  m_internalFace = make_shared<InternalFace>();
+  std::tie(m_internalFace, m_internalClientFace) = face::makeInternalFace(m_keyChain);
   m_forwarder->getFaceTable().addReserved(m_internalFace, FACEID_INTERNAL_FACE);
-  m_internalClientFace = makeInternalClientFace(m_internalFace, m_keyChain);
   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 5801499..57b5e8a 100644
--- a/daemon/nfd.hpp
+++ b/daemon/nfd.hpp
@@ -34,6 +34,9 @@
 #include <ndn-cxx/util/network-monitor.hpp>
 
 namespace ndn {
+
+class Face;
+
 namespace mgmt {
 
 class Dispatcher;
@@ -43,13 +46,12 @@
 
 namespace nfd {
 
+class Face;
 class Forwarder;
-class InternalFace;
 class FibManager;
 class FaceManager;
 class StrategyChoiceManager;
 class ForwarderStatusManager;
-class InternalClientFace;
 class CommandValidator;
 
 /**
@@ -107,10 +109,10 @@
 
   unique_ptr<Forwarder> m_forwarder;
 
-  ndn::KeyChain&                 m_keyChain;
-  shared_ptr<InternalFace>       m_internalFace;
-  shared_ptr<InternalClientFace> m_internalClientFace;
-  unique_ptr<CommandValidator>   m_validator;
+  ndn::KeyChain&               m_keyChain;
+  shared_ptr<Face>             m_internalFace;
+  shared_ptr<ndn::Face>        m_internalClientFace;
+  unique_ptr<CommandValidator> m_validator;
 
   unique_ptr<ndn::mgmt::Dispatcher>  m_dispatcher;
   unique_ptr<FibManager>             m_fibManager;
diff --git a/tests/daemon/face/internal-client-face.t.cpp b/tests/daemon/face/internal-client-face.t.cpp
deleted file mode 100644
index 0b2295c..0000000
--- a/tests/daemon/face/internal-client-face.t.cpp
+++ /dev/null
@@ -1,134 +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/internal-client-face.hpp"
-#include "face/internal-face.hpp"
-#include "tests/test-common.hpp"
-#include "tests/identity-management-fixture.hpp"
-
-namespace nfd {
-namespace tests {
-
-class InternalClientFaceFixture : public UnitTestTimeFixture
-                                , public IdentityManagementFixture
-{
-public:
-  InternalClientFaceFixture()
-    : m_internalFace(make_shared<InternalFace>())
-    , m_face(makeInternalClientFace(m_internalFace, m_keyChain))
-  {
-  }
-
-protected:
-  shared_ptr<InternalFace> m_internalFace;
-  shared_ptr<InternalClientFace> m_face;
-};
-
-BOOST_FIXTURE_TEST_SUITE(FaceInternalClientFace, InternalClientFaceFixture)
-
-BOOST_AUTO_TEST_CASE(ExpressInterest)
-{
-  bool didReceiveDataBack = false;
-  bool didTimeoutCallbackFire = false;
-  Data receivedData;
-
-  auto expressInterest = [&] (shared_ptr<Interest> interest) {
-    didReceiveDataBack = false;
-    didTimeoutCallbackFire = false;
-    m_face->expressInterest(interest->setInterestLifetime(time::milliseconds(100)),
-                            [&] (const Interest& interest, Data& data) {
-                              didReceiveDataBack = true;
-                              receivedData = data;
-                            },
-                            bind([&] { didTimeoutCallbackFire = true; }));
-    advanceClocks(time::milliseconds(1));
-  };
-
-  expressInterest(makeInterest("/test/timeout"));
-  advanceClocks(time::milliseconds(1), 200); // wait for time out
-  BOOST_CHECK(didTimeoutCallbackFire);
-
-  auto dataToSend = makeData("/test/data")->setContent(Block("\x81\x01\0x01", 3));
-  expressInterest(makeInterest("/test/data"));
-  m_internalFace->sendData(dataToSend); // send data to satisfy the expressed interest
-  advanceClocks(time::milliseconds(1));
-  BOOST_CHECK(didReceiveDataBack);
-  BOOST_CHECK(receivedData.wireEncode() == dataToSend.wireEncode());
-}
-
-BOOST_AUTO_TEST_CASE(InterestFilter)
-{
-  bool didOnInterestCallbackFire = false;
-  Block receivedBlock, expectedBlock;
-
-  auto testSendInterest = [&] (shared_ptr<Interest> interest) {
-    didOnInterestCallbackFire = false;
-    expectedBlock = interest->wireEncode();
-    m_internalFace->sendInterest(*interest);
-  };
-
-  testSendInterest(makeInterest("/test/filter")); // no filter is set now
-  BOOST_CHECK(!didOnInterestCallbackFire);
-
-  // set filter
-  auto filter = m_face->setInterestFilter("/test/filter",
-                                          bind([&](const Interest& interset) {
-                                              didOnInterestCallbackFire = true;
-                                              receivedBlock = interset.wireEncode();
-                                            }, _2));
-  advanceClocks(time::milliseconds(1));
-
-  testSendInterest(makeInterest("/test/filter"));
-  BOOST_CHECK(didOnInterestCallbackFire);
-  BOOST_CHECK(receivedBlock == expectedBlock);
-
-  // unset filter
-  didOnInterestCallbackFire = false;
-  m_face->unsetInterestFilter(filter);
-  advanceClocks(time::milliseconds(1));
-  testSendInterest(makeInterest("/test/filter"));
-  BOOST_CHECK(!didOnInterestCallbackFire);
-}
-
-BOOST_AUTO_TEST_CASE(PutData)
-{
-  bool didInternalFaceReceiveData = false;
-  Data receivedData;
-  m_internalFace->onReceiveData.connect([&] (const Data& data) {
-      didInternalFaceReceiveData = true;
-      receivedData = data;
-    });
-
-  auto dataToPut = makeData("/test/put/data");
-  m_face->put(*dataToPut);
-  advanceClocks(time::milliseconds(1));
-  BOOST_CHECK(didInternalFaceReceiveData);
-  BOOST_CHECK(receivedData.wireEncode() == dataToPut->wireEncode());
-}
-
-BOOST_AUTO_TEST_SUITE_END()
-
-} // namespace tests
-} // namespace nfd
diff --git a/tests/daemon/face/internal-face.t.cpp b/tests/daemon/face/internal-face.t.cpp
index 44f5e7b..eab0b67 100644
--- a/tests/daemon/face/internal-face.t.cpp
+++ b/tests/daemon/face/internal-face.t.cpp
@@ -24,120 +24,194 @@
  */
 
 #include "face/internal-face.hpp"
+#include "face/lp-face-wrapper.hpp"
 #include "tests/test-common.hpp"
+#include "tests/identity-management-fixture.hpp"
 
 namespace nfd {
+namespace face {
 namespace tests {
 
-class InternalFaceFixture : protected BaseFixture
+using namespace nfd::tests;
+
+BOOST_AUTO_TEST_SUITE(Face)
+
+class InternalFaceFixture : public UnitTestTimeFixture
+                          , public IdentityManagementFixture
 {
 public:
   InternalFaceFixture()
   {
-    m_face.onReceiveInterest.connect([this] (const Interest& interest) {
-        inInterests.push_back(interest);
-      });
-    m_face.onSendInterest.connect([this] (const Interest& interest) {
-        outInterests.push_back(interest);
-      });
-    m_face.onReceiveData.connect([this] (const Data& data) {
-        inData.push_back(data);
-      });
-    m_face.onSendData.connect([this] (const Data& data) {
-        outData.push_back(data);
-      });
+    std::tie(forwarderFace, clientFace) = makeInternalFace(m_keyChain);;
+
+    // TODO#3172 connect to afterReceive* signals
+    forwarderFace->onReceiveInterest.connect(
+      [this] (const Interest& interest) { receivedInterests.push_back(interest); } );
+    forwarderFace->onReceiveData.connect(
+      [this] (const Data& data) { receivedData.push_back(data); } );
+    forwarderFace->onReceiveNack.connect(
+      [this] (const lp::Nack& nack) { receivedNacks.push_back(nack); } );
   }
 
 protected:
-  InternalFace m_face;
-  std::vector<Interest> inInterests;
-  std::vector<Interest> outInterests;
-  std::vector<Data> inData;
-  std::vector<Data> outData;
+  shared_ptr<nfd::Face> forwarderFace;
+  shared_ptr<ndn::Face> clientFace;
+
+  std::vector<Interest> receivedInterests;
+  std::vector<Data> receivedData;
+  std::vector<lp::Nack> receivedNacks;
 };
 
-BOOST_FIXTURE_TEST_SUITE(FaceInternalFace, InternalFaceFixture)
+BOOST_FIXTURE_TEST_SUITE(TestInternalFace, InternalFaceFixture)
 
-BOOST_AUTO_TEST_CASE(SendInterest)
+// note: "send" and "receive" in test case names refer to the direction seen on forwarderFace.
+// i.e. "send" means transmission from forwarder to client,
+//      "receive" means transmission client to forwarder.
+
+BOOST_AUTO_TEST_CASE(ReceiveInterestTimeout)
 {
-  BOOST_CHECK(outInterests.empty());
+  shared_ptr<Interest> interest = makeInterest("/TLETccRv");
+  interest->setInterestLifetime(time::milliseconds(100));
 
-  auto interest = makeInterest("/test/send/interest");
-  Block expectedBlock = interest->wireEncode(); // assign a value to nonce
-  m_face.sendInterest(*interest);
+  bool hasTimeout = false;
+  clientFace->expressInterest(*interest,
+    bind([] { BOOST_ERROR("unexpected Data"); }),
+    bind([] { BOOST_ERROR("unexpected Nack"); }),
+    bind([&hasTimeout] { hasTimeout = true; }));
+  this->advanceClocks(time::milliseconds(1), 10);
 
-  BOOST_CHECK_EQUAL(outInterests.size(), 1);
-  BOOST_CHECK(outInterests[0].wireEncode() == expectedBlock);
+  BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
+  BOOST_CHECK_EQUAL(receivedInterests.back().getName(), "/TLETccRv");
+
+  this->advanceClocks(time::milliseconds(1), 100);
+
+  BOOST_CHECK(hasTimeout);
 }
 
-BOOST_AUTO_TEST_CASE(SendData)
+BOOST_AUTO_TEST_CASE(ReceiveInterestSendData)
 {
-  BOOST_CHECK(outData.empty());
+  shared_ptr<Interest> interest = makeInterest("/PQstEJGdL");
 
-  auto data = makeData("/test/send/data");
-  m_face.sendData(*data);
+  bool hasReceivedData = false;
+  clientFace->expressInterest(*interest,
+    [&hasReceivedData] (const Interest&, const Data& data) {
+      hasReceivedData = true;
+      BOOST_CHECK_EQUAL(data.getName(), "/PQstEJGdL/aI7oCrDXNX");
+    },
+    bind([] { BOOST_ERROR("unexpected Nack"); }),
+    bind([] { BOOST_ERROR("unexpected timeout"); }));
+  this->advanceClocks(time::milliseconds(1), 10);
 
-  BOOST_CHECK_EQUAL(outData.size(), 1);
-  BOOST_CHECK(outData[0].wireEncode() == data->wireEncode());
+  BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
+  BOOST_CHECK_EQUAL(receivedInterests.back().getName(), "/PQstEJGdL");
+
+  shared_ptr<Data> data = makeData("/PQstEJGdL/aI7oCrDXNX");
+  forwarderFace->sendData(*data);
+  this->advanceClocks(time::milliseconds(1), 10);
+
+  BOOST_CHECK(hasReceivedData);
 }
 
-BOOST_AUTO_TEST_CASE(ReceiveInterest)
+BOOST_AUTO_TEST_CASE(ReceiveInterestSendNack)
 {
-  BOOST_CHECK(inInterests.empty());
+  shared_ptr<Interest> interest = makeInterest("/1HrsRM1X", 152);
 
-  auto interest = makeInterest("/test/receive/interest");
-  Block expectedBlock = interest->wireEncode(); // assign a value to nonce
-  m_face.receiveInterest(*interest);
+  bool hasReceivedNack = false;
+  clientFace->expressInterest(*interest,
+    bind([] { BOOST_ERROR("unexpected Data"); }),
+    [&hasReceivedNack] (const Interest&, const lp::Nack& nack) {
+      hasReceivedNack = true;
+      BOOST_CHECK_EQUAL(nack.getReason(), lp::NackReason::NO_ROUTE);
+    },
+    bind([] { BOOST_ERROR("unexpected timeout"); }));
+  this->advanceClocks(time::milliseconds(1), 10);
 
-  BOOST_CHECK_EQUAL(inInterests.size(), 1);
-  BOOST_CHECK(inInterests[0].wireEncode() == expectedBlock);
+  BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
+  BOOST_CHECK_EQUAL(receivedInterests.back().getName(), "/1HrsRM1X");
+
+  lp::Nack nack = makeNack("/1HrsRM1X", 152, lp::NackReason::NO_ROUTE);
+  forwarderFace->sendNack(nack);
+  this->advanceClocks(time::milliseconds(1), 10);
+
+  BOOST_CHECK(hasReceivedNack);
 }
 
-BOOST_AUTO_TEST_CASE(ReceiveData)
+BOOST_AUTO_TEST_CASE(SendInterestReceiveData)
 {
-  BOOST_CHECK(inData.empty());
+  bool hasDeliveredInterest = false;
+  clientFace->setInterestFilter("/Wpc8TnEeoF",
+    [this, &hasDeliveredInterest] (const ndn::InterestFilter&, const Interest& interest) {
+      hasDeliveredInterest = true;
+      BOOST_CHECK_EQUAL(interest.getName(), "/Wpc8TnEeoF/f6SzV8hD");
 
-  auto data = makeData("/test/send/data");
-  m_face.receiveData(*data);
+      shared_ptr<Data> data = makeData("/Wpc8TnEeoF/f6SzV8hD/3uytUJCuIi");
+      clientFace->put(*data);
+    });
 
-  BOOST_CHECK_EQUAL(inData.size(), 1);
-  BOOST_CHECK(inData[0].wireEncode() == data->wireEncode());
+  shared_ptr<Interest> interest = makeInterest("/Wpc8TnEeoF/f6SzV8hD");
+  forwarderFace->sendInterest(*interest);
+  this->advanceClocks(time::milliseconds(1), 10);
+
+  BOOST_CHECK(hasDeliveredInterest);
+  BOOST_REQUIRE_EQUAL(receivedData.size(), 1);
+  BOOST_CHECK_EQUAL(receivedData.back().getName(), "/Wpc8TnEeoF/f6SzV8hD/3uytUJCuIi");
 }
 
-BOOST_AUTO_TEST_CASE(ReceiveBlock)
+BOOST_AUTO_TEST_CASE(SendInterestReceiveNack)
 {
-  BOOST_CHECK(inInterests.empty());
-  BOOST_CHECK(inData.empty());
+  bool hasDeliveredInterest = false;
+  clientFace->setInterestFilter("/4YgJKWcXN",
+    [this, &hasDeliveredInterest] (const ndn::InterestFilter&, const Interest& interest) {
+      hasDeliveredInterest = true;
+      BOOST_CHECK_EQUAL(interest.getName(), "/4YgJKWcXN/5oaTe05o");
 
-  Block interestBlock = makeInterest("test/receive/interest")->wireEncode();
-  m_face.receive(interestBlock);
-  BOOST_CHECK_EQUAL(inInterests.size(), 1);
-  BOOST_CHECK(inInterests[0].wireEncode() == interestBlock);
+      lp::Nack nack = makeNack("/4YgJKWcXN/5oaTe05o", 191, lp::NackReason::NO_ROUTE);
+      clientFace->put(nack);
+    });
 
-  Block dataBlock = makeData("test/receive/data")->wireEncode();
-  m_face.receive(dataBlock);
-  BOOST_CHECK_EQUAL(inData.size(), 1);
-  BOOST_CHECK(inData[0].wireEncode() == dataBlock);
+  shared_ptr<Interest> interest = makeInterest("/4YgJKWcXN/5oaTe05o", 191);
+  forwarderFace->sendInterest(*interest);
+  this->advanceClocks(time::milliseconds(1), 10);
+
+  BOOST_CHECK(hasDeliveredInterest);
+  BOOST_REQUIRE_EQUAL(receivedNacks.size(), 1);
+  BOOST_CHECK_EQUAL(receivedNacks.back().getReason(), lp::NackReason::NO_ROUTE);
 }
 
-BOOST_AUTO_TEST_CASE(ExtractPacketFromBlock)
+BOOST_AUTO_TEST_CASE(CloseForwarderFace)
 {
-  {
-    Block block = makeInterest("/test/interest")->wireEncode();
-    const Block& payload = ndn::nfd::LocalControlHeader::getPayload(block);
-    auto interest = m_face.extractPacketFromBlock<Interest>(block, payload);
-    BOOST_CHECK(interest->wireEncode() == block);
-  }
+  forwarderFace->close();
+  this->advanceClocks(time::milliseconds(1), 10);
+  BOOST_CHECK_EQUAL(static_pointer_cast<face::LpFaceWrapper>(forwarderFace)->getLpFace()->getState(), FaceState::CLOSED);
+  forwarderFace.reset();
 
-  {
-    Block block = makeData("/test/data")->wireEncode();
-    const Block& payload = ndn::nfd::LocalControlHeader::getPayload(block);
-    auto data = m_face.extractPacketFromBlock<Data>(block, payload);
-    BOOST_CHECK(data->wireEncode() == block);
-  }
+  shared_ptr<Interest> interest = makeInterest("/zpHsVesu0B");
+  interest->setInterestLifetime(time::milliseconds(100));
+
+  bool hasTimeout = false;
+  clientFace->expressInterest(*interest,
+    bind([] { BOOST_ERROR("unexpected Data"); }),
+    bind([] { BOOST_ERROR("unexpected Nack"); }),
+    bind([&hasTimeout] { hasTimeout = true; }));
+  BOOST_CHECK_NO_THROW(this->advanceClocks(time::milliseconds(1), 200));
+
+  BOOST_CHECK_EQUAL(receivedInterests.size(), 0);
+  BOOST_CHECK(hasTimeout);
 }
 
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_CASE(CloseClientFace)
+{
+  g_io.poll(); // #3248 workaround
+  clientFace.reset();
+
+  shared_ptr<Interest> interest = makeInterest("/aau42XQqb");
+  forwarderFace->sendInterest(*interest);
+  BOOST_CHECK_NO_THROW(this->advanceClocks(time::milliseconds(1), 10));
+}
+
+BOOST_AUTO_TEST_SUITE_END() // TestInternalFace
+BOOST_AUTO_TEST_SUITE_END() // Face
 
 } // namespace tests
+} // namespace face
 } // namespace nfd
diff --git a/tests/daemon/fw/topology-tester.cpp b/tests/daemon/fw/topology-tester.cpp
index 10a0b31..8b94abc 100644
--- a/tests/daemon/fw/topology-tester.cpp
+++ b/tests/daemon/fw/topology-tester.cpp
@@ -31,64 +31,29 @@
 namespace fw {
 namespace tests {
 
+using face::InternalTransportBase;
+using face::InternalForwarderTransport;
+using face::InternalClientTransport;
 using face::LpFaceWrapper;
+using face::GenericLinkService;
 
-TopologyForwarderTransport::TopologyForwarderTransport(
-    const FaceUri& localUri, const FaceUri& remoteUri,
-    ndn::nfd::FaceScope scope, ndn::nfd::LinkType linkType)
-{
-  this->setLocalUri(localUri);
-  this->setRemoteUri(remoteUri);
-  this->setScope(scope);
-  this->setPersistency(ndn::nfd::FACE_PERSISTENCY_PERMANENT);
-  this->setLinkType(linkType);
-}
-
-void
-TopologyForwarderTransport::receiveFromTopology(const Block& packet)
-{
-  Packet p;
-  p.packet = packet;
-  this->receive(std::move(p));
-}
-
-void
-TopologyForwarderTransport::doSend(Packet&& packet)
-{
-  this->emitSignal(afterSend, packet.packet);
-}
-
-void
-TopologyClientTransport::receiveFromTopology(const Block& packet)
-{
-  if (m_receiveCallback) {
-    m_receiveCallback(packet);
-  }
-}
-
-void
-TopologyClientTransport::send(const Block& wire)
-{
-  this->emitSignal(afterSend, wire);
-}
-
-void
-TopologyClientTransport::send(const Block& header, const Block& payload)
-{
-  ndn::EncodingBuffer encoder(header.size() + payload.size(), header.size() + payload.size());
-  encoder.appendByteArray(header.wire(), header.size());
-  encoder.appendByteArray(payload.wire(), payload.size());
-
-  this->send(encoder.block());
-}
-
-TopologyLinkBase::TopologyLinkBase()
+TopologyLink::TopologyLink(const time::nanoseconds& delay)
   : m_isUp(true)
+  , m_delay(delay)
 {
+  BOOST_ASSERT(delay > time::nanoseconds::zero());
+  // zero delay does not work on OSX
 }
 
 void
-TopologyLinkBase::attachTransport(TopologyNode i, TopologyTransportBase* transport)
+TopologyLink::addFace(TopologyNode i, shared_ptr<LpFaceWrapper> face)
+{
+  this->attachTransport(i, dynamic_cast<InternalTransportBase*>(face->getLpFace()->getTransport()));
+  m_faces[i] = face;
+}
+
+void
+TopologyLink::attachTransport(TopologyNode i, InternalTransportBase* transport)
 {
   BOOST_ASSERT(transport != nullptr);
   BOOST_ASSERT(m_transports.count(i) == 0);
@@ -98,7 +63,7 @@
 }
 
 void
-TopologyLinkBase::transmit(TopologyNode i, const Block& packet)
+TopologyLink::transmit(TopologyNode i, const Block& packet)
 {
   if (!m_isUp) {
     return;
@@ -109,49 +74,38 @@
       continue;
     }
 
-    TopologyTransportBase* recipient = p.second;
+    InternalTransportBase* recipient = p.second;
     this->scheduleReceive(recipient, packet);
   }
 }
 
-TopologyLink::TopologyLink(const time::nanoseconds& delay)
-  : m_delay(delay)
-{
-  BOOST_ASSERT(delay > time::nanoseconds::zero());
-  // zero delay does not work on OSX
-}
-
 void
-TopologyLink::addFace(TopologyNode i, shared_ptr<LpFaceWrapper> face)
-{
-  this->attachTransport(i, dynamic_cast<TopologyTransportBase*>(face->getLpFace()->getTransport()));
-  m_faces[i] = face;
-}
-
-void
-TopologyLink::scheduleReceive(TopologyTransportBase* recipient, const Block& packet)
+TopologyLink::scheduleReceive(InternalTransportBase* recipient, const Block& packet)
 {
   scheduler::schedule(m_delay, [packet, recipient] {
-    recipient->receiveFromTopology(packet);
+    recipient->receiveFromLink(packet);
   });
 }
 
-TopologyAppLink::TopologyAppLink(shared_ptr<LpFaceWrapper> face)
-  : m_face(face)
+TopologyAppLink::TopologyAppLink(shared_ptr<LpFaceWrapper> forwarderFace)
+  : m_face(forwarderFace)
+  , m_forwarderTransport(static_cast<InternalForwarderTransport*>(forwarderFace->getLpFace()->getTransport()))
+  , m_clientTransport(make_shared<InternalClientTransport>())
+  , m_client(make_shared<ndn::Face>(m_clientTransport, getGlobalIoService()))
 {
-  this->attachTransport(0, dynamic_cast<TopologyTransportBase*>(face->getLpFace()->getTransport()));
-
-  auto clientTransport = make_shared<TopologyClientTransport>();
-  m_client = make_shared<ndn::Face>(clientTransport, getGlobalIoService());
-  this->attachTransport(1, clientTransport.get());
+  this->recover();
 }
 
 void
-TopologyAppLink::scheduleReceive(TopologyTransportBase* recipient, const Block& packet)
+TopologyAppLink::fail()
 {
-  getGlobalIoService().post([packet, recipient] {
-    recipient->receiveFromTopology(packet);
-  });
+  m_clientTransport->connectToForwarder(nullptr);
+}
+
+void
+TopologyAppLink::recover()
+{
+  m_clientTransport->connectToForwarder(m_forwarderTransport);
 }
 
 TopologyNode
@@ -179,8 +133,8 @@
     Forwarder& forwarder = this->getForwarder(i);
     FaceUri localUri("topology://" + m_forwarderLabels.at(i) + "/" + label);
 
-    auto service = make_unique<face::GenericLinkService>();
-    auto transport = make_unique<TopologyForwarderTransport>(localUri, remoteUri,
+    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));
@@ -200,8 +154,8 @@
   FaceUri localUri("topology://" + m_forwarderLabels.at(i) + "/local/" + label);
   FaceUri remoteUri("topology://" + m_forwarderLabels.at(i) + "/app/" + label);
 
-  auto service = make_unique<face::GenericLinkService>();
-  auto transport = make_unique<TopologyForwarderTransport>(localUri, remoteUri,
+  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));
diff --git a/tests/daemon/fw/topology-tester.hpp b/tests/daemon/fw/topology-tester.hpp
index dd6d77d..9a10ad7 100644
--- a/tests/daemon/fw/topology-tester.hpp
+++ b/tests/daemon/fw/topology-tester.hpp
@@ -31,7 +31,7 @@
 #define NFD_TESTS_NFD_FW_TOPOLOGY_TESTER_HPP
 
 #include <ndn-cxx/face.hpp>
-#include <ndn-cxx/transport/transport.hpp>
+#include "face/internal-transport.hpp"
 #include "face/lp-face-wrapper.hpp"
 #include "fw/strategy.hpp"
 #include "tests/test-common.hpp"
@@ -42,84 +42,17 @@
 
 using namespace nfd::tests;
 
-/** \brief abstracts a Transport used in TopologyTester
- */
-class TopologyTransportBase
-{
-public:
-  /** \brief causes the transport to receive a link-layer packet
-   */
-  virtual void
-  receiveFromTopology(const Block& packet) = 0;
-
-  signal::Signal<TopologyTransportBase, Block> afterSend;
-
-protected:
-  DECLARE_SIGNAL_EMIT(afterSend)
-};
-
-/** \brief implements a forwarder-side Transport used in TopologyTester
- */
-class TopologyForwarderTransport : public face::Transport, public TopologyTransportBase
-{
-public:
-  TopologyForwarderTransport(const FaceUri& localUri, const FaceUri& remoteUri,
-                             ndn::nfd::FaceScope scope, ndn::nfd::LinkType linkType);
-
-  virtual void
-  receiveFromTopology(const Block& packet) DECL_OVERRIDE;
-
-protected:
-  virtual void
-  doClose() DECL_OVERRIDE
-  {
-  }
-
-private:
-  virtual void
-  doSend(Packet&& packet) DECL_OVERRIDE;
-};
-
-/** \brief implements a client-side Transport used in TopologyTester
- */
-class TopologyClientTransport : public ndn::Transport, public TopologyTransportBase
-{
-public:
-  virtual void
-  receiveFromTopology(const Block& packet) DECL_OVERRIDE;
-
-  virtual void
-  close() DECL_OVERRIDE
-  {
-  }
-
-  virtual void
-  pause() DECL_OVERRIDE
-  {
-  }
-
-  virtual void
-  resume() DECL_OVERRIDE
-  {
-  }
-
-  virtual void
-  send(const Block& wire) DECL_OVERRIDE;
-
-  virtual void
-  send(const Block& header, const Block& payload) DECL_OVERRIDE;
-};
-
 /** \brief identifies a node (forwarder) in the topology
  */
 typedef size_t TopologyNode;
 
-/** \brief represents a network or local-app link
+/** \brief represents a network link in the topology which connects two or more nodes
  */
-class TopologyLinkBase : noncopyable
+class TopologyLink : noncopyable
 {
 public:
-  TopologyLinkBase();
+  explicit
+  TopologyLink(const time::nanoseconds& delay);
 
   /** \brief fail the link, cause packets to be dropped silently
    */
@@ -137,32 +70,6 @@
     m_isUp = true;
   }
 
-protected:
-  /** \brief attach a Transport onto this link
-   */
-  void
-  attachTransport(TopologyNode i, TopologyTransportBase* transport);
-
-private:
-  void
-  transmit(TopologyNode i, const Block& packet);
-
-  virtual void
-  scheduleReceive(TopologyTransportBase* recipient, const Block& packet) = 0;
-
-protected:
-  bool m_isUp;
-  std::unordered_map<TopologyNode, TopologyTransportBase*> m_transports;
-};
-
-/** \brief represents a network link in the topology which connects two or more nodes
- */
-class TopologyLink : public TopologyLinkBase
-{
-public:
-  explicit
-  TopologyLink(const time::nanoseconds& delay);
-
   void
   addFace(TopologyNode i, shared_ptr<face::LpFaceWrapper> face);
 
@@ -174,22 +81,43 @@
     return *m_faces.at(i);
   }
 
-private:
-  virtual void
-  scheduleReceive(TopologyTransportBase* recipient, const Block& packet) DECL_OVERRIDE;
+protected:
+  /** \brief attach a Transport onto this link
+   */
+  void
+  attachTransport(TopologyNode i, face::InternalTransportBase* transport);
 
 private:
+  void
+  transmit(TopologyNode i, const Block& packet);
+
+  void
+  scheduleReceive(face::InternalTransportBase* recipient, const Block& packet);
+
+private:
+  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;
 };
 
 /** \brief represents a link to a local application
  */
-class TopologyAppLink : public TopologyLinkBase
+class TopologyAppLink : noncopyable
 {
 public:
   explicit
-  TopologyAppLink(shared_ptr<face::LpFaceWrapper> face);
+  TopologyAppLink(shared_ptr<face::LpFaceWrapper> forwarderFace);
+
+  /** \brief fail the link, cause packets to be dropped silently
+   */
+  void
+  fail();
+
+  /** \brief recover the link from a failure
+   */
+  void
+  recover();
 
   /** \return face on forwarder side
    */
@@ -208,11 +136,9 @@
   }
 
 private:
-  virtual void
-  scheduleReceive(TopologyTransportBase* recipient, const Block& packet) DECL_OVERRIDE;
-
-private:
-  shared_ptr<face::LpFaceWrapper> m_face;
+  shared_ptr<Face> m_face;
+  face::InternalForwarderTransport* m_forwarderTransport;
+  shared_ptr<face::InternalClientTransport> m_clientTransport;
   shared_ptr<ndn::Face> m_client;
 };
 
