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;
 };
 
