diff --git a/tests/daemon/fw/topology-tester.cpp b/tests/daemon/fw/topology-tester.cpp
index c401aef..0e19b57 100644
--- a/tests/daemon/fw/topology-tester.cpp
+++ b/tests/daemon/fw/topology-tester.cpp
@@ -24,6 +24,7 @@
  */
 
 #include "topology-tester.hpp"
+
 #include "daemon/global.hpp"
 #include "face/generic-link-service.hpp"
 
@@ -33,13 +34,19 @@
 namespace fw {
 namespace tests {
 
-using face::InternalTransportBase;
-using face::InternalForwarderTransport;
-using face::InternalClientTransport;
 using face::GenericLinkService;
+using face::InternalClientTransport;
+using face::InternalForwarderTransport;
+
+TopologyLink::NodeTransport::NodeTransport(shared_ptr<Face> f, ReceiveProxy::Callback cb)
+  : face(std::move(f))
+  , transport(dynamic_cast<InternalForwarderTransport*>(face->getTransport()))
+  , proxy(std::move(cb))
+{
+  BOOST_ASSERT(transport != nullptr);
+}
 
 TopologyLink::TopologyLink(time::nanoseconds delay)
-  : m_isUp(true)
 {
   this->setDelay(delay);
 }
@@ -66,19 +73,19 @@
 void
 TopologyLink::addFace(TopologyNode i, shared_ptr<Face> face)
 {
-  BOOST_ASSERT(m_transports.count(i) == 0);
-  auto& nodeTransport = m_transports[i];
+  auto receiveCb = [this, i] (Block&& pkt) { transmit(i, std::move(pkt)); };
 
-  nodeTransport.face = face;
+  auto ret = m_transports.emplace(std::piecewise_construct,
+                                  std::forward_as_tuple(i),
+                                  std::forward_as_tuple(std::move(face), std::move(receiveCb)));
+  BOOST_ASSERT(ret.second);
 
-  nodeTransport.transport = dynamic_cast<InternalTransportBase*>(face->getTransport());
-  BOOST_ASSERT(nodeTransport.transport != nullptr);
-  nodeTransport.transport->afterSend.connect(
-    [this, i] (const Block& packet) { this->transmit(i, packet); });
+  auto& node = ret.first->second;
+  node.transport->setPeer(&node.proxy);
 }
 
 void
-TopologyLink::transmit(TopologyNode i, const Block& packet)
+TopologyLink::transmit(TopologyNode i, Block&& packet)
 {
   if (!m_isUp) {
     return;
@@ -91,22 +98,21 @@
       continue;
     }
 
-    InternalTransportBase* recipient = p.second.transport;
-    this->scheduleReceive(recipient, packet);
+    this->scheduleReceive(p.second.transport, Block{packet});
   }
 }
 
 void
-TopologyLink::scheduleReceive(InternalTransportBase* recipient, const Block& packet)
+TopologyLink::scheduleReceive(face::InternalTransportBase* recipient, Block&& packet)
 {
-  getScheduler().schedule(m_delay, [packet, recipient] {
-    recipient->receiveFromLink(packet);
+  getScheduler().schedule(m_delay, [=, pkt = std::move(packet)] () mutable {
+    recipient->receivePacket(std::move(pkt));
   });
 }
 
 TopologyAppLink::TopologyAppLink(shared_ptr<Face> forwarderFace)
-  : m_face(forwarderFace)
-  , m_forwarderTransport(static_cast<InternalForwarderTransport*>(forwarderFace->getTransport()))
+  : m_face(std::move(forwarderFace))
+  , m_forwarderTransport(static_cast<InternalForwarderTransport*>(m_face->getTransport()))
   , m_clientTransport(make_shared<InternalClientTransport>())
   , m_client(make_shared<ndn::Face>(m_clientTransport, getGlobalIoService()))
 {
@@ -190,7 +196,7 @@
     auto face = make_shared<Face>(std::move(service), std::move(transport));
 
     forwarder.addFace(face);
-    link->addFace(i, face);
+    link->addFace(i, std::move(face));
   }
 
   m_links.push_back(link); // keep a shared_ptr so callers don't have to
@@ -212,7 +218,7 @@
 
   forwarder.addFace(face);
 
-  auto al = make_shared<TopologyAppLink>(face);
+  auto al = make_shared<TopologyAppLink>(std::move(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 cbd8fd9..2c8d7d0 100644
--- a/tests/daemon/fw/topology-tester.hpp
+++ b/tests/daemon/fw/topology-tester.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -108,21 +108,48 @@
 
 private:
   void
-  transmit(TopologyNode i, const Block& packet);
+  transmit(TopologyNode i, Block&& packet);
 
   void
-  scheduleReceive(face::InternalTransportBase* recipient, const Block& packet);
+  scheduleReceive(face::InternalTransportBase* recipient, Block&& packet);
 
 private:
-  bool m_isUp;
+  bool m_isUp = true;
   time::nanoseconds m_delay;
 
-  struct NodeTransport
+  class ReceiveProxy : public face::InternalTransportBase
   {
-    face::InternalTransportBase* transport;
+  public:
+    using Callback = std::function<void(Block&&)>;
+
+    explicit
+    ReceiveProxy(Callback cb)
+      : m_cb(std::move(cb))
+    {
+    }
+
+    void
+    receivePacket(Block&& packet) final
+    {
+      m_cb(std::move(packet));
+    }
+
+  private:
+    Callback m_cb;
+  };
+
+  class NodeTransport
+  {
+  public:
+    NodeTransport(shared_ptr<Face> face, ReceiveProxy::Callback receiveCallback);
+
+  public:
     shared_ptr<Face> face;
+    face::InternalForwarderTransport* transport;
+    ReceiveProxy proxy;
     std::set<TopologyNode> blockedDestinations;
   };
+
   std::unordered_map<TopologyNode, NodeTransport> m_transports;
 };
 
