diff --git a/daemon/fw/best-route-strategy2.cpp b/daemon/fw/best-route-strategy2.cpp
index 2ec786c..e0e31dc 100644
--- a/daemon/fw/best-route-strategy2.cpp
+++ b/daemon/fw/best-route-strategy2.cpp
@@ -31,7 +31,7 @@
 
 NFD_LOG_INIT("BestRouteStrategy2");
 
-const Name BestRouteStrategy2::STRATEGY_NAME("ndn:/localhost/nfd/strategy/best-route/%FD%03");
+const Name BestRouteStrategy2::STRATEGY_NAME("ndn:/localhost/nfd/strategy/best-route/%FD%04");
 NFD_REGISTER_STRATEGY(BestRouteStrategy2);
 
 BestRouteStrategy2::BestRouteStrategy2(Forwarder& forwarder, const Name& name)
@@ -104,8 +104,7 @@
   const fib::NextHopList& nexthops = fibEntry->getNextHops();
   fib::NextHopList::const_iterator it = nexthops.end();
 
-  RetxSuppression::Result suppression =
-      m_retxSuppression.decide(inFace, interest, *pitEntry);
+  RetxSuppression::Result suppression = m_retxSuppression.decide(inFace, interest, *pitEntry);
   if (suppression == RetxSuppression::NEW) {
     // forward to nexthop with lowest cost except downstream
     it = std::find_if(nexthops.begin(), nexthops.end(),
@@ -114,6 +113,11 @@
 
     if (it == nexthops.end()) {
       NFD_LOG_DEBUG(interest << " from=" << inFace.getId() << " noNextHop");
+
+      lp::NackHeader nackHeader;
+      nackHeader.setReason(lp::NackReason::NO_ROUTE);
+      this->sendNack(pitEntry, inFace, nackHeader);
+
       this->rejectPendingInterest(pitEntry);
       return;
     }
@@ -156,5 +160,72 @@
   }
 }
 
+/** \return less severe NackReason between x and y
+ *
+ *  lp::NackReason::NONE is treated as most severe
+ */
+inline lp::NackReason
+compareLessSevere(lp::NackReason x, lp::NackReason y)
+{
+  if (x == lp::NackReason::NONE) {
+    return y;
+  }
+  if (y == lp::NackReason::NONE) {
+    return x;
+  }
+  return static_cast<lp::NackReason>(std::min(static_cast<int>(x), static_cast<int>(y)));
+}
+
+void
+BestRouteStrategy2::afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+                                     shared_ptr<fib::Entry> fibEntry,
+                                     shared_ptr<pit::Entry> pitEntry)
+{
+  int nOutRecordsNotNacked = 0;
+  Face* lastFaceNotNacked = nullptr;
+  lp::NackReason leastSevereReason = lp::NackReason::NONE;
+  for (const pit::OutRecord& outR : pitEntry->getOutRecords()) {
+    const lp::NackHeader* inNack = outR.getIncomingNack();
+    if (inNack == nullptr) {
+      ++nOutRecordsNotNacked;
+      lastFaceNotNacked = outR.getFace().get();
+      continue;
+    }
+
+    leastSevereReason = compareLessSevere(leastSevereReason, inNack->getReason());
+  }
+
+  lp::NackHeader outNack;
+  outNack.setReason(leastSevereReason);
+
+  if (nOutRecordsNotNacked == 1) {
+    BOOST_ASSERT(lastFaceNotNacked != nullptr);
+    pit::InRecordCollection::const_iterator inR = pitEntry->getInRecord(*lastFaceNotNacked);
+    if (inR != pitEntry->getInRecords().end()) {
+      // one out-record not Nacked, which is also a downstream
+      NFD_LOG_DEBUG(nack.getInterest() << " nack-from=" << inFace.getId() <<
+                    " nack=" << nack.getReason() <<
+                    " nack-to(bidirectional)=" << lastFaceNotNacked->getId() <<
+                    " out-nack=" << outNack.getReason());
+      this->sendNack(pitEntry, *lastFaceNotNacked, outNack);
+      return;
+    }
+  }
+
+  if (nOutRecordsNotNacked > 0) {
+    NFD_LOG_DEBUG(nack.getInterest() << " nack-from=" << inFace.getId() <<
+                  " nack=" << nack.getReason() <<
+                  " waiting=" << nOutRecordsNotNacked);
+    // continue waiting
+    return;
+  }
+
+
+  NFD_LOG_DEBUG(nack.getInterest() << " nack-from=" << inFace.getId() <<
+                " nack=" << nack.getReason() <<
+                " nack-to=all out-nack=" << outNack.getReason());
+  this->sendNacks(pitEntry, outNack);
+}
+
 } // namespace fw
 } // namespace nfd
diff --git a/daemon/fw/best-route-strategy2.hpp b/daemon/fw/best-route-strategy2.hpp
index bf3eba2..8c19dc0 100644
--- a/daemon/fw/best-route-strategy2.hpp
+++ b/daemon/fw/best-route-strategy2.hpp
@@ -32,13 +32,22 @@
 namespace nfd {
 namespace fw {
 
-/** \brief Best Route strategy version 3
+/** \brief Best Route strategy version 4
  *
  *  This strategy forwards a new Interest to the lowest-cost nexthop (except downstream).
  *  After that, if consumer retransmits the Interest (and is not suppressed according to
  *  exponential backoff algorithm), the strategy forwards the Interest again to
  *  the lowest-cost nexthop (except downstream) that is not previously used.
- *  If all nexthops have been used, the strategy starts over.
+ *  If all nexthops have been used, the strategy starts over with the first nexthop.
+ *
+ *  This strategy returns Nack to all downstreams with reason NoRoute
+ *  if there is no usable nexthop, which may be caused by:
+ *  (a) the FIB entry contains no nexthop;
+ *  (b) the FIB nexthop happens to be the sole downstream;
+ *  (c) the FIB nexthops violate scope.
+ *
+ *  This strategy returns Nack to all downstreams if all upstreams have returned Nacks.
+ *  The reason of the sent Nack equals the least severe reason among received Nacks.
  */
 class BestRouteStrategy2 : public Strategy
 {
@@ -46,11 +55,15 @@
   BestRouteStrategy2(Forwarder& forwarder, const Name& name = STRATEGY_NAME);
 
   virtual void
-  afterReceiveInterest(const Face& inFace,
-                       const Interest& interest,
+  afterReceiveInterest(const Face& inFace, const Interest& interest,
                        shared_ptr<fib::Entry> fibEntry,
                        shared_ptr<pit::Entry> pitEntry) DECL_OVERRIDE;
 
+  virtual void
+  afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+                   shared_ptr<fib::Entry> fibEntry,
+                   shared_ptr<pit::Entry> pitEntry) DECL_OVERRIDE;
+
 public:
   static const Name STRATEGY_NAME;
 
diff --git a/daemon/fw/face-table.cpp b/daemon/fw/face-table.cpp
index f256d20..1884203 100644
--- a/daemon/fw/face-table.cpp
+++ b/daemon/fw/face-table.cpp
@@ -89,6 +89,8 @@
                                        &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));
 
   this->onAdd(face);
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 27bfa38..20428c5 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -60,7 +60,7 @@
       interest.getLink();
     }
   }
-  catch (tlv::Error&) {
+  catch (const tlv::Error&) {
     NFD_LOG_DEBUG("startProcessInterest face=" << face.getId() <<
                   " interest=" << interest.getName() << " malformed");
     // It's safe to call interest.getName() because Name has been fully parsed
@@ -80,6 +80,25 @@
 }
 
 void
+Forwarder::startProcessNack(Face& face, const lp::Nack& nack)
+{
+  // check fields used by forwarding are well-formed
+  try {
+    if (nack.getInterest().hasLink()) {
+      nack.getInterest().getLink();
+    }
+  }
+  catch (const tlv::Error&) {
+    NFD_LOG_DEBUG("startProcessNack face=" << face.getId() <<
+                  " nack=" << nack.getInterest().getName() <<
+                  "~" << nack.getReason() << " malformed");
+    return;
+  }
+
+  this->onIncomingNack(face, nack);
+}
+
+void
 Forwarder::onIncomingInterest(Face& inFace, const Interest& interest)
 {
   // receive Interest
@@ -131,10 +150,23 @@
 Forwarder::onInterestLoop(Face& inFace, const Interest& interest,
                           shared_ptr<pit::Entry> pitEntry)
 {
-  NFD_LOG_DEBUG("onInterestLoop face=" << inFace.getId() <<
-                " interest=" << interest.getName());
+  // if multi-access face, drop
+  if (inFace.isMultiAccess()) {
+    NFD_LOG_DEBUG("onInterestLoop face=" << inFace.getId() <<
+                  " interest=" << interest.getName() <<
+                  " drop");
+    return;
+  }
 
-  // (drop)
+  NFD_LOG_DEBUG("onInterestLoop face=" << inFace.getId() <<
+                " interest=" << interest.getName() <<
+                " send-Nack-duplicate");
+
+  // send Nack with reason=DUPLICATE
+  // note: Don't enter outgoing Nack pipeline because it needs an in-record.
+  lp::Nack nack(interest);
+  nack.setReason(lp::NackReason::DUPLICATE);
+  inFace.sendNack(nack);
 }
 
 void
@@ -362,7 +394,7 @@
   // CS insert
   m_cs.insert(data);
 
-  std::set<shared_ptr<Face> > pendingDownstreams;
+  std::set<Face*> pendingDownstreams;
   // foreach PitEntry
   for (const shared_ptr<pit::Entry>& pitEntry : pitMatches) {
     NFD_LOG_DEBUG("onIncomingData matching=" << pitEntry->getName());
@@ -372,10 +404,9 @@
 
     // remember pending downstreams
     const pit::InRecordCollection& inRecords = pitEntry->getInRecords();
-    for (pit::InRecordCollection::const_iterator it = inRecords.begin();
-                                                 it != inRecords.end(); ++it) {
-      if (it->getExpiry() > time::steady_clock::now()) {
-        pendingDownstreams.insert(it->getFace());
+    for (const pit::InRecord& inRecord : inRecords) {
+      if (inRecord.getExpiry() > time::steady_clock::now()) {
+        pendingDownstreams.insert(inRecord.getFace().get());
       }
     }
 
@@ -395,10 +426,8 @@
   }
 
   // foreach pending downstream
-  for (std::set<shared_ptr<Face> >::iterator it = pendingDownstreams.begin();
-      it != pendingDownstreams.end(); ++it) {
-    shared_ptr<Face> pendingDownstream = *it;
-    if (pendingDownstream.get() == &inFace) {
+  for (Face* pendingDownstream : pendingDownstreams) {
+    if (pendingDownstream == &inFace) {
       continue;
     }
     // goto outgoing Data pipeline
@@ -447,6 +476,104 @@
   ++m_counters.getNOutDatas();
 }
 
+void
+Forwarder::onIncomingNack(Face& inFace, const lp::Nack& nack)
+{
+  // if multi-access face, drop
+  if (inFace.isMultiAccess()) {
+    NFD_LOG_DEBUG("onIncomingNack face=" << inFace.getId() <<
+                  " nack=" << nack.getInterest().getName() <<
+                  "~" << nack.getReason() << " face-is-multi-access");
+    return;
+  }
+
+  // PIT match
+  shared_ptr<pit::Entry> pitEntry = m_pit.find(nack.getInterest());
+  // if no PIT entry found, drop
+  if (pitEntry == nullptr) {
+    NFD_LOG_DEBUG("onIncomingNack face=" << inFace.getId() <<
+                  " nack=" << nack.getInterest().getName() <<
+                  "~" << nack.getReason() << " no-PIT-entry");
+    return;
+  }
+
+  // has out-record?
+  pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(inFace);
+  // if no out-record found, drop
+  if (outRecord == pitEntry->getOutRecords().end()) {
+    NFD_LOG_DEBUG("onIncomingNack face=" << inFace.getId() <<
+                  " nack=" << nack.getInterest().getName() <<
+                  "~" << nack.getReason() << " no-out-record");
+    return;
+  }
+
+  // if out-record has different Nonce, drop
+  if (nack.getInterest().getNonce() != outRecord->getLastNonce()) {
+    NFD_LOG_DEBUG("onIncomingNack face=" << inFace.getId() <<
+                  " nack=" << nack.getInterest().getName() <<
+                  "~" << nack.getReason() << " wrong-Nonce " <<
+                  nack.getInterest().getNonce() << "!=" << outRecord->getLastNonce());
+    return;
+  }
+
+  NFD_LOG_DEBUG("onIncomingNack face=" << inFace.getId() <<
+                " nack=" << nack.getInterest().getName() <<
+                "~" << nack.getReason() << " OK");
+
+  // record Nack on out-record
+  outRecord->setIncomingNack(nack);
+
+  // trigger strategy: after receive NACK
+  shared_ptr<fib::Entry> fibEntry = m_fib.findLongestPrefixMatch(*pitEntry);
+  this->dispatchToStrategy(pitEntry, bind(&Strategy::afterReceiveNack, _1,
+                                          cref(inFace), cref(nack), fibEntry, pitEntry));
+}
+
+void
+Forwarder::onOutgoingNack(shared_ptr<pit::Entry> pitEntry, const Face& outFace,
+                          const lp::NackHeader& nack)
+{
+  if (outFace.getId() == INVALID_FACEID) {
+    NFD_LOG_WARN("onOutgoingNack face=invalid" <<
+                  " nack=" << pitEntry->getInterest().getName() <<
+                  "~" << nack.getReason() << " no-in-record");
+    return;
+  }
+
+  // has in-record?
+  pit::InRecordCollection::const_iterator inRecord = pitEntry->getInRecord(outFace);
+
+  // if no in-record found, drop
+  if (inRecord == pitEntry->getInRecords().end()) {
+    NFD_LOG_DEBUG("onOutgoingNack face=" << outFace.getId() <<
+                  " nack=" << pitEntry->getInterest().getName() <<
+                  "~" << nack.getReason() << " no-in-record");
+    return;
+  }
+
+  // if multi-access face, drop
+  if (outFace.isMultiAccess()) {
+    NFD_LOG_DEBUG("onOutgoingNack face=" << outFace.getId() <<
+                  " nack=" << pitEntry->getInterest().getName() <<
+                  "~" << nack.getReason() << " face-is-multi-access");
+    return;
+  }
+
+  NFD_LOG_DEBUG("onOutgoingNack face=" << outFace.getId() <<
+                " nack=" << pitEntry->getInterest().getName() <<
+                "~" << nack.getReason() << " OK");
+
+  // create Nack packet with the Interest from in-record
+  lp::Nack nackPkt(inRecord->getInterest());
+  nackPkt.setHeader(nack);
+
+  // erase in-record
+  pitEntry->deleteInRecord(outFace);
+
+  // send Nack on face
+  const_cast<Face&>(outFace).sendNack(nackPkt);
+}
+
 static inline bool
 compare_InRecord_expiry(const pit::InRecord& a, const pit::InRecord& b)
 {
diff --git a/daemon/fw/forwarder.hpp b/daemon/fw/forwarder.hpp
index 155ec4a..ebfaa05 100644
--- a/daemon/fw/forwarder.hpp
+++ b/daemon/fw/forwarder.hpp
@@ -90,6 +90,12 @@
   void
   startProcessData(Face& face, const Data& data);
 
+  /** \brief start incoming Nack processing
+   *  \param nack the incoming Nack, must be created with make_shared
+   */
+  void
+  startProcessNack(Face& face, const lp::Nack& nack);
+
   NameTree&
   getNameTree();
 
@@ -128,12 +134,12 @@
 
   /** \brief Content Store miss pipeline
   */
-  void
+  VIRTUAL_WITH_TESTS void
   onContentStoreMiss(const Face& inFace, shared_ptr<pit::Entry> pitEntry, const Interest& interest);
 
   /** \brief Content Store hit pipeline
   */
-  void
+  VIRTUAL_WITH_TESTS void
   onContentStoreHit(const Face& inFace, shared_ptr<pit::Entry> pitEntry,
                     const Interest& interest, const Data& data);
 
@@ -176,6 +182,16 @@
   VIRTUAL_WITH_TESTS void
   onOutgoingData(const Data& data, Face& outFace);
 
+  /** \brief incoming Nack pipeline
+   */
+  VIRTUAL_WITH_TESTS void
+  onIncomingNack(Face& inFace, const lp::Nack& nack);
+
+  /** \brief outgoing Nack pipeline
+   */
+  VIRTUAL_WITH_TESTS void
+  onOutgoingNack(shared_ptr<pit::Entry> pitEntry, const Face& outFace, const lp::NackHeader& nack);
+
 PROTECTED_WITH_TESTS_ELSE_PRIVATE:
   VIRTUAL_WITH_TESTS void
   setUnsatisfyTimer(shared_ptr<pit::Entry> pitEntry);
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index 4f439db..7b0504e 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -60,23 +60,36 @@
   NFD_LOG_DEBUG("beforeExpirePendingInterest pitEntry=" << pitEntry->getName());
 }
 
-//void
-//Strategy::afterAddFibEntry(shared_ptr<fib::Entry> fibEntry)
-//{
-//  NFD_LOG_DEBUG("afterAddFibEntry fibEntry=" << fibEntry->getPrefix());
-//}
-//
-//void
-//Strategy::afterUpdateFibEntry(shared_ptr<fib::Entry> fibEntry)
-//{
-//  NFD_LOG_DEBUG("afterUpdateFibEntry fibEntry=" << fibEntry->getPrefix());
-//}
-//
-//void
-//Strategy::beforeRemoveFibEntry(shared_ptr<fib::Entry> fibEntry)
-//{
-//  NFD_LOG_DEBUG("beforeRemoveFibEntry fibEntry=" << fibEntry->getPrefix());
-//}
+void
+Strategy::afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+                           shared_ptr<fib::Entry> fibEntry, shared_ptr<pit::Entry> pitEntry)
+{
+  NFD_LOG_DEBUG("afterReceiveNack inFace=" << inFace.getId() <<
+                " pitEntry=" << pitEntry->getName());
+}
+
+void
+Strategy::sendNacks(shared_ptr<pit::Entry> pitEntry, const lp::NackHeader& header,
+                    std::initializer_list<const Face*> exceptFaces)
+{
+  // populate downstreams with all downstreams faces
+  std::unordered_set<const Face*> downstreams;
+  const pit::InRecordCollection& inRecords = pitEntry->getInRecords();
+  std::transform(inRecords.begin(), inRecords.end(), std::inserter(downstreams, downstreams.end()),
+                 [] (const pit::InRecord& inR) { return inR.getFace().get(); });
+
+  // delete excluded faces
+  // .erase in a loop is more efficient than std::set_difference between that requires sorted range
+  for (const Face* exceptFace : exceptFaces) {
+    downstreams.erase(exceptFace);
+  }
+
+  // send Nacks
+  for (const Face* downstream : downstreams) {
+    this->sendNack(pitEntry, *downstream, header);
+  }
+  // warning: don't loop on pitEntry->getInRecords(), because InRecord is erased when sending Nack
+}
 
 } // namespace fw
 } // namespace nfd
diff --git a/daemon/fw/strategy.hpp b/daemon/fw/strategy.hpp
index 8eca1db..ebbb361 100644
--- a/daemon/fw/strategy.hpp
+++ b/daemon/fw/strategy.hpp
@@ -70,7 +70,7 @@
    *    invoke this->rejectPendingInterest so that PIT entry will be deleted shortly
    *
    *  \note The strategy is permitted to store a weak reference to fibEntry.
-   *        Do not store a shared reference, because PIT entry may be deleted at any moment.
+   *        Do not store a shared reference, because FIB entry may be deleted at any moment.
    *        fibEntry is passed by value to allow obtaining a weak reference from it.
    *  \note The strategy is permitted to store a shared reference to pitEntry.
    *        pitEntry is passed by value to reflect this fact.
@@ -110,11 +110,33 @@
   virtual void
   beforeExpirePendingInterest(shared_ptr<pit::Entry> pitEntry);
 
+  /** \brief trigger after Nack is received
+   *
+   *  This trigger is invoked when an incoming Nack is received in response to
+   *  an forwarded Interest.
+   *  The Nack has been confirmed to be a response to the last Interest forwarded
+   *  to that upstream, i.e. the PIT out-record exists and has a matching Nonce.
+   *  The NackHeader has been recorded in the PIT out-record.
+   *
+   *  In this base class this method does nothing.
+   *
+   *  \note The strategy is permitted to store a weak reference to fibEntry.
+   *        Do not store a shared reference, because PIT entry may be deleted at any moment.
+   *        fibEntry is passed by value to allow obtaining a weak reference from it.
+   *  \note The strategy is permitted to store a shared reference to pitEntry.
+   *        pitEntry is passed by value to reflect this fact.
+   */
+  virtual void
+  afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+                   shared_ptr<fib::Entry> fibEntry, shared_ptr<pit::Entry> pitEntry);
+
 protected: // actions
-  /// send Interest to outFace
+  /** \brief send Interest to outFace
+   *  \param wantNewNonce if true, a new Nonce will be generated,
+   *                      rather than reusing a Nonce from one of the PIT in-records
+   */
   VIRTUAL_WITH_TESTS void
-  sendInterest(shared_ptr<pit::Entry> pitEntry,
-               shared_ptr<Face> outFace,
+  sendInterest(shared_ptr<pit::Entry> pitEntry, shared_ptr<Face> outFace,
                bool wantNewNonce = false);
 
   /** \brief decide that a pending Interest cannot be forwarded
@@ -125,6 +147,22 @@
   VIRTUAL_WITH_TESTS void
   rejectPendingInterest(shared_ptr<pit::Entry> pitEntry);
 
+  /** \brief send Nack to outFace
+   *
+   *  The outFace must have a PIT in-record, otherwise this method has no effect.
+   */
+  VIRTUAL_WITH_TESTS void
+  sendNack(shared_ptr<pit::Entry> pitEntry, const Face& outFace,
+           const lp::NackHeader& header);
+
+  /** \brief send Nack to every face that has an in-record,
+   *         except those in \p exceptFaces
+   *  \note This is not an action, but a helper that invokes the sendNack action.
+   */
+  void
+  sendNacks(shared_ptr<pit::Entry> pitEntry, const lp::NackHeader& header,
+            std::initializer_list<const Face*> exceptFaces = std::initializer_list<const Face*>());
+
 protected: // accessors
   MeasurementsAccessor&
   getMeasurements();
@@ -171,6 +209,13 @@
   m_forwarder.onInterestReject(pitEntry);
 }
 
+inline void
+Strategy::sendNack(shared_ptr<pit::Entry> pitEntry, const Face& outFace,
+                   const lp::NackHeader& header)
+{
+  m_forwarder.onOutgoingNack(pitEntry, outFace, header);
+}
+
 inline MeasurementsAccessor&
 Strategy::getMeasurements()
 {
diff --git a/daemon/table/pit-entry.cpp b/daemon/table/pit-entry.cpp
index da7c6ed..85ea19c 100644
--- a/daemon/table/pit-entry.cpp
+++ b/daemon/table/pit-entry.cpp
@@ -149,6 +149,16 @@
 }
 
 void
+Entry::deleteInRecord(const Face& face)
+{
+  auto it = std::find_if(m_inRecords.begin(), m_inRecords.end(),
+    [&face] (const InRecord& inRecord) { return inRecord.getFace().get() == &face; });
+  if (it != m_inRecords.end()) {
+    m_inRecords.erase(it);
+  }
+}
+
+void
 Entry::deleteInRecords()
 {
   m_inRecords.clear();
@@ -168,8 +178,8 @@
   return it;
 }
 
-OutRecordCollection::const_iterator
-Entry::getOutRecord(const Face& face) const
+OutRecordCollection::iterator
+Entry::getOutRecord(const Face& face)
 {
   return std::find_if(m_outRecords.begin(), m_outRecords.end(),
     [&face] (const OutRecord& outRecord) { return outRecord.getFace().get() == &face; });
diff --git a/daemon/table/pit-entry.hpp b/daemon/table/pit-entry.hpp
index 6d59ce8..3f15598 100644
--- a/daemon/table/pit-entry.hpp
+++ b/daemon/table/pit-entry.hpp
@@ -132,6 +132,10 @@
   InRecordCollection::const_iterator
   getInRecord(const Face& face) const;
 
+  /// deletes one InRecord for face if exists
+  void
+  deleteInRecord(const Face& face);
+
   /// deletes all InRecords
   void
   deleteInRecords();
@@ -151,8 +155,8 @@
   /** \brief get the OutRecord for face
    *  \return an iterator to the OutRecord, or .end if it does not exist
    */
-  OutRecordCollection::const_iterator
-  getOutRecord(const Face& face) const;
+  OutRecordCollection::iterator
+  getOutRecord(const Face& face);
 
   /// deletes one OutRecord for face if exists
   void
diff --git a/daemon/table/pit-out-record.cpp b/daemon/table/pit-out-record.cpp
index 268b67b..1cf303d 100644
--- a/daemon/table/pit-out-record.cpp
+++ b/daemon/table/pit-out-record.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 "pit-out-record.hpp"
 
@@ -32,5 +33,16 @@
 {
 }
 
+bool
+OutRecord::setIncomingNack(const lp::Nack& nack)
+{
+  if (nack.getInterest().getNonce() != this->getLastNonce()) {
+    return false;
+  }
+
+  m_incomingNack.reset(new lp::NackHeader(nack.getHeader()));
+  return true;
+}
+
 } // namespace pit
 } // namespace nfd
diff --git a/daemon/table/pit-out-record.hpp b/daemon/table/pit-out-record.hpp
index c75e005..4717779 100644
--- a/daemon/table/pit-out-record.hpp
+++ b/daemon/table/pit-out-record.hpp
@@ -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/>.
- **/
+ */
 
 #ifndef NFD_DAEMON_TABLE_PIT_OUT_RECORD_HPP
 #define NFD_DAEMON_TABLE_PIT_OUT_RECORD_HPP
@@ -30,14 +31,49 @@
 namespace nfd {
 namespace pit {
 
-/** \class OutRecord
- *  \brief contains information about an Interest toward an outgoing face
+/** \brief contains information about an Interest toward an outgoing face
  */
 class OutRecord : public FaceRecord
 {
 public:
   explicit
   OutRecord(shared_ptr<Face> face);
+
+  /** \return last NACK returned by \p getFace()
+   *
+   *  A nullptr return value means the Interest is still pending or has timed out.
+   *  A non-null return value means the last outgoing Interest has been NACKed.
+   */
+  const lp::NackHeader*
+  getIncomingNack() const
+  {
+    return m_incomingNack.get();
+  }
+
+  /** \brief sets a NACK received from \p getFace()
+   *  \return whether incoming NACK is accepted
+   *
+   *  This is invoked in incoming NACK pipeline.
+   *  An incoming NACK is accepted if its Nonce matches \p getLastNonce().
+   *  If accepted, \p nack.getHeader() will be copied,
+   *  and any pointer previously returned by \p .getIncomingNack() .
+   */
+  bool
+  setIncomingNack(const lp::Nack& nack);
+
+  /** \brief clears last NACK
+   *
+   *  This is invoked in outgoing Interest pipeline.
+   *  This invalidates any pointer previously returned by \p .getIncomingNack() .
+   */
+  void
+  clearIncomingNack()
+  {
+    m_incomingNack.reset();
+  }
+
+private:
+  unique_ptr<lp::NackHeader> m_incomingNack;
 };
 
 } // namespace pit
diff --git a/daemon/table/pit.cpp b/daemon/table/pit.cpp
index c21ccdf..959593f 100644
--- a/daemon/table/pit.cpp
+++ b/daemon/table/pit.cpp
@@ -62,7 +62,7 @@
 }
 
 std::pair<shared_ptr<pit::Entry>, bool>
-Pit::insert(const Interest& interest)
+Pit::findOrInsert(const Interest& interest, bool allowInsert)
 {
   // first lookup() the Interest Name in the NameTree, which will creates all
   // the intermedia nodes, starting from the shortest prefix.
@@ -78,13 +78,17 @@
                                   entry->getInterest().getSelectors() == interest.getSelectors();
                          });
   if (it != pitEntries.end()) {
-    return { *it, false };
+    return {*it, false};
+  }
+
+  if (!allowInsert) {
+    return {nullptr, true};
   }
 
   shared_ptr<pit::Entry> entry = make_shared<pit::Entry>(interest);
   nameTreeEntry->insertPitEntry(entry);
   m_nItems++;
-  return { entry, true };
+  return {entry, true};
 }
 
 pit::DataMatchResult
diff --git a/daemon/table/pit.hpp b/daemon/table/pit.hpp
index e9616d5..adab085 100644
--- a/daemon/table/pit.hpp
+++ b/daemon/table/pit.hpp
@@ -58,10 +58,17 @@
   size_t
   size() const;
 
+  /** \brief finds a PIT entry for Interest
+   *  \param interest the Interest
+   *  \return an existing entry with same Name and Selectors; otherwise nullptr
+   */
+  shared_ptr<pit::Entry>
+  find(const Interest& interest) const;
+
   /** \brief inserts a PIT entry for Interest
-   *
-   *  If an entry for exact same name and selectors exists, that entry is returned.
-   *  \return the entry, and true for new entry, false for existing entry
+   *  \param interest the Interest; must be created with make_shared
+   *  \return a new or existing entry with same Name and Selectors,
+   *          and true for new entry, false for existing entry
    */
   std::pair<shared_ptr<pit::Entry>, bool>
   insert(const Interest& interest);
@@ -135,6 +142,18 @@
   };
 
 private:
+  /** \brief finds or inserts a PIT entry for Interest
+   *  \param interest the Interest; must be created with make_shared if allowInsert
+   *  \param allowInsert whether inserting new entry is allowed.
+   *  \return if allowInsert, a new or existing entry with same Name+Selectors,
+   *          and true for new entry, false for existing entry;
+   *          if not allowInsert, an existing entry with same Name+Selectors and false,
+   *          or {nullptr, true} if there's no existing entry
+   */
+  std::pair<shared_ptr<pit::Entry>, bool>
+  findOrInsert(const Interest& interest, bool allowInsert);
+
+private:
   NameTree& m_nameTree;
   size_t m_nItems;
 };
@@ -145,6 +164,18 @@
   return m_nItems;
 }
 
+inline shared_ptr<pit::Entry>
+Pit::find(const Interest& interest) const
+{
+  return const_cast<Pit*>(this)->findOrInsert(interest, false).first;
+}
+
+inline std::pair<shared_ptr<pit::Entry>, bool>
+Pit::insert(const Interest& interest)
+{
+  return this->findOrInsert(interest, true);
+}
+
 inline Pit::const_iterator
 Pit::end() const
 {
diff --git a/tests/daemon/fw/access-strategy.t.cpp b/tests/daemon/fw/access-strategy.t.cpp
index ddc0092..fa211a6 100644
--- a/tests/daemon/fw/access-strategy.t.cpp
+++ b/tests/daemon/fw/access-strategy.t.cpp
@@ -47,7 +47,8 @@
 // code style rule 3.25. This is necessary because some lines ends with '\' which
 // would cause "multi-line comment" compiler warning if '//' comments are used.
 
-BOOST_FIXTURE_TEST_SUITE(FwAccessStrategy, UnitTestTimeFixture)
+BOOST_AUTO_TEST_SUITE(Fw)
+BOOST_FIXTURE_TEST_SUITE(TestAccessStrategy, UnitTestTimeFixture)
 
 class TwoLaptopsFixture : public UnitTestTimeFixture
 {
@@ -65,14 +66,14 @@
      *      +---------+             +---------+
      */
 
-    router = topo.addForwarder();
-    laptopA = topo.addForwarder();
-    laptopB = topo.addForwarder();
+    router = topo.addForwarder("R");
+    laptopA = topo.addForwarder("A");
+    laptopB = topo.addForwarder("B");
 
     topo.setStrategy<fw::AccessStrategy>(router);
 
-    linkA = topo.addLink(time::milliseconds(10), {router, laptopA});
-    linkB = topo.addLink(time::milliseconds(20), {router, laptopB});
+    linkA = topo.addLink("RA", time::milliseconds(10), {router, laptopA});
+    linkB = topo.addLink("RB", time::milliseconds(20), {router, laptopB});
   }
 
 protected:
@@ -115,19 +116,19 @@
   topo.registerPrefix(router, linkA->getFace(router), "ndn:/laptops");
   topo.registerPrefix(router, linkB->getFace(router), "ndn:/laptops");
 
-  shared_ptr<TopologyAppLink> producer = topo.addAppFace(laptopA, "ndn:/laptops/A");
-  topo.addEchoProducer(*producer->getClientFace());
+  shared_ptr<TopologyAppLink> producer = topo.addAppFace("p", laptopA, "ndn:/laptops/A");
+  topo.addEchoProducer(producer->getClientFace());
 
-  shared_ptr<TopologyAppLink> consumer = topo.addAppFace(router);
-  topo.addIntervalConsumer(*consumer->getClientFace(), "ndn:/laptops/A",
+  shared_ptr<TopologyAppLink> consumer = topo.addAppFace("c", router);
+  topo.addIntervalConsumer(consumer->getClientFace(), "ndn:/laptops/A",
                            time::milliseconds(100), 100);
 
   this->advanceClocks(time::milliseconds(5), time::seconds(12));
 
   // most Interests should be satisfied, and few Interests can go to wrong laptop
-  BOOST_CHECK_GE(consumer->getForwarderFace()->m_sentDatas.size(), 97);
-  BOOST_CHECK_GE(linkA->getFace(router)->m_sentInterests.size(), 97);
-  BOOST_CHECK_LE(linkB->getFace(router)->m_sentInterests.size(), 5);
+  BOOST_CHECK_GE(consumer->getForwarderFace().getCounters().getNOutDatas(), 97);
+  BOOST_CHECK_GE(linkA->getFace(router).getCounters().getNOutInterests(), 97);
+  BOOST_CHECK_LE(linkB->getFace(router).getCounters().getNOutInterests(), 5);
 }
 
 BOOST_FIXTURE_TEST_CASE(FastSlowProducer, TwoLaptopsFixture)
@@ -160,21 +161,21 @@
   topo.registerPrefix(router, linkA->getFace(router), "ndn:/laptops");
   topo.registerPrefix(router, linkB->getFace(router), "ndn:/laptops");
 
-  shared_ptr<TopologyAppLink> producerA = topo.addAppFace(laptopA, "ndn:/laptops/BOTH");
-  topo.addEchoProducer(*producerA->getClientFace());
-  shared_ptr<TopologyAppLink> producerB = topo.addAppFace(laptopB, "ndn:/laptops/BOTH");
-  topo.addEchoProducer(*producerB->getClientFace());
+  shared_ptr<TopologyAppLink> producerA = topo.addAppFace("pA", laptopA, "ndn:/laptops/BOTH");
+  topo.addEchoProducer(producerA->getClientFace());
+  shared_ptr<TopologyAppLink> producerB = topo.addAppFace("pB", laptopB, "ndn:/laptops/BOTH");
+  topo.addEchoProducer(producerB->getClientFace());
 
-  shared_ptr<TopologyAppLink> consumer = topo.addAppFace(router);
-  topo.addIntervalConsumer(*consumer->getClientFace(), "ndn:/laptops/BOTH",
+  shared_ptr<TopologyAppLink> consumer = topo.addAppFace("c", router);
+  topo.addIntervalConsumer(consumer->getClientFace(), "ndn:/laptops/BOTH",
                            time::milliseconds(100), 100);
 
   this->advanceClocks(time::milliseconds(5), time::seconds(12));
 
   // most Interests should be satisfied, and few Interests can go to slower laptopB
-  BOOST_CHECK_GE(consumer->getForwarderFace()->m_sentDatas.size(), 97);
-  BOOST_CHECK_GE(linkA->getFace(router)->m_sentInterests.size(), 90);
-  BOOST_CHECK_LE(linkB->getFace(router)->m_sentInterests.size(), 15);
+  BOOST_CHECK_GE(consumer->getForwarderFace().getCounters().getNOutDatas(), 97);
+  BOOST_CHECK_GE(linkA->getFace(router).getCounters().getNOutInterests(), 90);
+  BOOST_CHECK_LE(linkB->getFace(router).getCounters().getNOutInterests(), 15);
 }
 
 BOOST_FIXTURE_TEST_CASE(ProducerMobility, TwoLaptopsFixture)
@@ -207,13 +208,13 @@
   topo.registerPrefix(router, linkA->getFace(router), "ndn:/laptops");
   topo.registerPrefix(router, linkB->getFace(router), "ndn:/laptops");
 
-  shared_ptr<TopologyAppLink> producerA = topo.addAppFace(laptopA, "ndn:/laptops/M");
-  topo.addEchoProducer(*producerA->getClientFace());
-  shared_ptr<TopologyAppLink> producerB = topo.addAppFace(laptopB, "ndn:/laptops/M");
-  topo.addEchoProducer(*producerB->getClientFace());
+  shared_ptr<TopologyAppLink> producerA = topo.addAppFace("pA", laptopA, "ndn:/laptops/M");
+  topo.addEchoProducer(producerA->getClientFace());
+  shared_ptr<TopologyAppLink> producerB = topo.addAppFace("pB", laptopB, "ndn:/laptops/M");
+  topo.addEchoProducer(producerB->getClientFace());
 
-  shared_ptr<TopologyAppLink> consumer = topo.addAppFace(router);
-  topo.addIntervalConsumer(*consumer->getClientFace(), "ndn:/laptops/M",
+  shared_ptr<TopologyAppLink> consumer = topo.addAppFace("c", router);
+  topo.addIntervalConsumer(consumer->getClientFace(), "ndn:/laptops/M",
                            time::milliseconds(100), 100);
 
   // producer is initially on laptopA
@@ -221,19 +222,19 @@
   this->advanceClocks(time::milliseconds(5), time::seconds(6));
 
   // few Interests can go to laptopB
-  BOOST_CHECK_LE(linkB->getFace(router)->m_sentInterests.size(), 5);
+  BOOST_CHECK_LE(linkB->getFace(router).getCounters().getNOutInterests(), 5);
 
   // producer moves to laptopB
   producerA->fail();
   producerB->recover();
-  linkA->getFace(router)->m_sentInterests.clear();
+  const_cast<FaceCounters&>(linkA->getFace(router).getCounters()).getNOutInterests().set(0);
   this->advanceClocks(time::milliseconds(5), time::seconds(6));
 
   // few additional Interests can go to laptopA
-  BOOST_CHECK_LE(linkA->getFace(router)->m_sentInterests.size(), 5);
+  BOOST_CHECK_LE(linkA->getFace(router).getCounters().getNOutInterests(), 5);
 
   // most Interests should be satisfied
-  BOOST_CHECK_GE(consumer->getForwarderFace()->m_sentDatas.size(), 97);
+  BOOST_CHECK_GE(consumer->getForwarderFace().getCounters().getNOutDatas(), 97);
 }
 
 BOOST_FIXTURE_TEST_CASE(Bidirectional, TwoLaptopsFixture)
@@ -263,23 +264,23 @@
   topo.registerPrefix(router, linkA->getFace(router), "ndn:/laptops");
   topo.registerPrefix(router, linkB->getFace(router), "ndn:/laptops");
 
-  shared_ptr<TopologyAppLink> producerA = topo.addAppFace(laptopA, "ndn:/laptops/A");
-  topo.addEchoProducer(*producerA->getClientFace());
-  shared_ptr<TopologyAppLink> producerB = topo.addAppFace(laptopB, "ndn:/laptops/B");
-  topo.addEchoProducer(*producerB->getClientFace());
+  shared_ptr<TopologyAppLink> producerA = topo.addAppFace("pA", laptopA, "ndn:/laptops/A");
+  topo.addEchoProducer(producerA->getClientFace());
+  shared_ptr<TopologyAppLink> producerB = topo.addAppFace("pB", laptopB, "ndn:/laptops/B");
+  topo.addEchoProducer(producerB->getClientFace());
 
-  shared_ptr<TopologyAppLink> consumerAB = topo.addAppFace(laptopA);
-  topo.addIntervalConsumer(*consumerAB->getClientFace(), "ndn:/laptops/B",
+  shared_ptr<TopologyAppLink> consumerAB = topo.addAppFace("cAB", laptopA);
+  topo.addIntervalConsumer(consumerAB->getClientFace(), "ndn:/laptops/B",
                            time::milliseconds(100), 100);
-  shared_ptr<TopologyAppLink> consumerBA = topo.addAppFace(laptopB);
-  topo.addIntervalConsumer(*consumerBA->getClientFace(), "ndn:/laptops/A",
+  shared_ptr<TopologyAppLink> consumerBA = topo.addAppFace("cBA", laptopB);
+  topo.addIntervalConsumer(consumerBA->getClientFace(), "ndn:/laptops/A",
                            time::milliseconds(100), 100);
 
   this->advanceClocks(time::milliseconds(5), time::seconds(12));
 
   // most Interests should be satisfied
-  BOOST_CHECK_GE(consumerAB->getForwarderFace()->m_sentDatas.size(), 97);
-  BOOST_CHECK_GE(consumerBA->getForwarderFace()->m_sentDatas.size(), 97);
+  BOOST_CHECK_GE(consumerAB->getForwarderFace().getCounters().getNOutDatas(), 97);
+  BOOST_CHECK_GE(consumerBA->getForwarderFace().getCounters().getNOutDatas(), 97);
 }
 
 BOOST_FIXTURE_TEST_CASE(PacketLoss, TwoLaptopsFixture)
@@ -308,25 +309,25 @@
   // laptopA has prefix in router FIB; laptopB is unused in this test case
   topo.registerPrefix(router, linkA->getFace(router), "ndn:/laptops");
 
-  shared_ptr<TopologyAppLink> producerA = topo.addAppFace(laptopA, "ndn:/laptops/A");
-  topo.addEchoProducer(*producerA->getClientFace());
+  shared_ptr<TopologyAppLink> producerA = topo.addAppFace("pA", laptopA, "ndn:/laptops/A");
+  topo.addEchoProducer(producerA->getClientFace());
 
-  shared_ptr<TopologyAppLink> consumer = topo.addAppFace(router);
+  shared_ptr<TopologyAppLink> consumer = topo.addAppFace("c", router);
 
   // Interest 1 completes normally
   shared_ptr<Interest> interest1 = makeInterest("ndn:/laptops/A/1");
   bool hasData1 = false;
-  consumer->getClientFace()->expressInterest(*interest1,
-                                             bind([&hasData1] { hasData1 = true; }));
+  consumer->getClientFace().expressInterest(*interest1,
+                                            bind([&hasData1] { hasData1 = true; }));
   this->advanceClocks(time::milliseconds(5), time::seconds(1));
   BOOST_CHECK_EQUAL(hasData1, true);
 
   // Interest 2 experiences a packet loss on initial transmission
   shared_ptr<Interest> interest2a = makeInterest("ndn:/laptops/A/2");
   bool hasData2a = false, hasTimeout2a = false;
-  consumer->getClientFace()->expressInterest(*interest2a,
-                                             bind([&hasData2a] { hasData2a = true; }),
-                                             bind([&hasTimeout2a] { hasTimeout2a = true; }));
+  consumer->getClientFace().expressInterest(*interest2a,
+                                            bind([&hasData2a] { hasData2a = true; }),
+                                            bind([&hasTimeout2a] { hasTimeout2a = true; }));
   producerA->fail();
   this->advanceClocks(time::milliseconds(5), time::milliseconds(60));
   BOOST_CHECK_EQUAL(hasData2a, false);
@@ -335,8 +336,8 @@
   // Interest 2 retransmission is suppressed
   shared_ptr<Interest> interest2b = makeInterest("ndn:/laptops/A/2");
   bool hasData2b = false;
-  consumer->getClientFace()->expressInterest(*interest2b,
-                                             bind([&hasData2b] { hasData2b = true; }));
+  consumer->getClientFace().expressInterest(*interest2b,
+                                            bind([&hasData2b] { hasData2b = true; }));
   producerA->recover();
   this->advanceClocks(time::milliseconds(5), time::seconds(1));
   BOOST_CHECK_EQUAL(hasData2b, false);
@@ -344,8 +345,8 @@
   // Interest 2 retransmission gets through, and is answered
   shared_ptr<Interest> interest2c = makeInterest("ndn:/laptops/A/2");
   bool hasData2c = false;
-  consumer->getClientFace()->expressInterest(*interest2c,
-                                             bind([&hasData2c] { hasData2c = true; }));
+  consumer->getClientFace().expressInterest(*interest2c,
+                                            bind([&hasData2c] { hasData2c = true; }));
   this->advanceClocks(time::milliseconds(5), time::seconds(1));
   BOOST_CHECK_EQUAL(hasData2c, true);
 }
@@ -357,17 +358,18 @@
   topo.registerPrefix(router, linkA->getFace(router), "ndn:/net");
 
   // send Interests from laptopA to router
-  shared_ptr<TopologyAppLink> consumer = topo.addAppFace(laptopA);
-  topo.addIntervalConsumer(*consumer->getClientFace(), "ndn:/net",
+  shared_ptr<TopologyAppLink> consumer = topo.addAppFace("c", laptopA);
+  topo.addIntervalConsumer(consumer->getClientFace(), "ndn:/net",
                            time::milliseconds(100), 10);
 
   this->advanceClocks(time::milliseconds(5), time::seconds(2));
 
   // Interest shouldn't loop back from router
-  BOOST_CHECK_EQUAL(linkA->getFace(router)->m_sentInterests.size(), 0);
+  BOOST_CHECK_EQUAL(linkA->getFace(router).getCounters().getNOutInterests(), 0);
 }
 
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestAccessStrategy
+BOOST_AUTO_TEST_SUITE_END() // Fw
 
 } // namespace tests
 } // namespace fw
diff --git a/tests/daemon/fw/best-route-strategy2.t.cpp b/tests/daemon/fw/best-route-strategy2.t.cpp
index 8a2c3db..4ee43e9 100644
--- a/tests/daemon/fw/best-route-strategy2.t.cpp
+++ b/tests/daemon/fw/best-route-strategy2.t.cpp
@@ -24,10 +24,11 @@
  */
 
 #include "fw/best-route-strategy2.hpp"
-#include "strategy-tester.hpp"
 
 #include "tests/test-common.hpp"
 #include "tests/daemon/face/dummy-face.hpp"
+#include "strategy-tester.hpp"
+#include "topology-tester.hpp"
 
 namespace nfd {
 namespace fw {
@@ -35,33 +36,51 @@
 
 using namespace nfd::tests;
 
-BOOST_FIXTURE_TEST_SUITE(FwBestRouteStrategy2, UnitTestTimeFixture)
+BOOST_AUTO_TEST_SUITE(Fw)
+
+class BestRouteStrategy2Fixture : public UnitTestTimeFixture
+{
+protected:
+  BestRouteStrategy2Fixture()
+    : strategy(forwarder)
+    , fib(forwarder.getFib())
+    , pit(forwarder.getPit())
+    , face1(make_shared<DummyFace>())
+    , face2(make_shared<DummyFace>())
+    , face3(make_shared<DummyFace>())
+    , face4(make_shared<DummyFace>())
+    , face5(make_shared<DummyFace>())
+  {
+    forwarder.addFace(face1);
+    forwarder.addFace(face2);
+    forwarder.addFace(face3);
+    forwarder.addFace(face4);
+    forwarder.addFace(face5);
+  }
+
+public:
+  Forwarder forwarder;
+  StrategyTester<fw::BestRouteStrategy2> strategy;
+  Fib& fib;
+  Pit& pit;
+
+  shared_ptr<DummyFace> face1;
+  shared_ptr<DummyFace> face2;
+  shared_ptr<DummyFace> face3;
+  shared_ptr<DummyFace> face4;
+  shared_ptr<DummyFace> face5;
+};
+
+BOOST_FIXTURE_TEST_SUITE(TestBestRouteStrategy2, BestRouteStrategy2Fixture)
 
 BOOST_AUTO_TEST_CASE(Forward)
 {
-  Forwarder forwarder;
-  typedef StrategyTester<fw::BestRouteStrategy2> BestRouteStrategy2Tester;
-  BestRouteStrategy2Tester 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<DummyFace> face4 = make_shared<DummyFace>();
-  shared_ptr<DummyFace> face5 = make_shared<DummyFace>();
-  forwarder.addFace(face1);
-  forwarder.addFace(face2);
-  forwarder.addFace(face3);
-  forwarder.addFace(face4);
-  forwarder.addFace(face5);
-
-  Fib& fib = forwarder.getFib();
   shared_ptr<fib::Entry> fibEntry = fib.insert(Name()).first;
   fibEntry->addNextHop(face1, 10);
   fibEntry->addNextHop(face2, 20);
   fibEntry->addNextHop(face3, 30);
 
   shared_ptr<Interest> interest = makeInterest("ndn:/BzgFBchqA");
-  Pit& pit = forwarder.getPit();
   shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
 
   const time::nanoseconds TICK = time::duration_cast<time::nanoseconds>(
@@ -71,20 +90,20 @@
   // however face1 is downstream so it cannot be used
   pitEntry->insertOrUpdateInRecord(face1, *interest);
   strategy.afterReceiveInterest(*face1, *interest, fibEntry, pitEntry);
-  BOOST_REQUIRE_EQUAL(strategy.m_sendInterestHistory.size(), 1);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory.back().get<1>(), face2);
+  BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory.back().outFaceId, face2->getId());
 
   // downstream retransmits frequently, but the strategy should not send Interests
   // more often than DEFAULT_MIN_RETX_INTERVAL
   scheduler::EventId retxFrom4Evt;
-  size_t nSentLast = strategy.m_sendInterestHistory.size();
+  size_t nSentLast = strategy.sendInterestHistory.size();
   time::steady_clock::TimePoint timeSentLast = time::steady_clock::now();
   function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
   periodicalRetxFrom4 = [&] {
     pitEntry->insertOrUpdateInRecord(face4, *interest);
     strategy.afterReceiveInterest(*face4, *interest, fibEntry, pitEntry);
 
-    size_t nSent = strategy.m_sendInterestHistory.size();
+    size_t nSent = strategy.sendInterestHistory.size();
     if (nSent > nSentLast) {
       BOOST_CHECK_EQUAL(nSent - nSentLast, 1);
       time::steady_clock::TimePoint timeSent = time::steady_clock::now();
@@ -101,29 +120,346 @@
 
   // nexthops for accepted retransmissions: follow FIB cost,
   // later forward to an eligible upstream with earliest OutRecord
-  BOOST_REQUIRE_GE(strategy.m_sendInterestHistory.size(), 6);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory[1].get<1>(), face1);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory[2].get<1>(), face3);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory[3].get<1>(), face2);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory[4].get<1>(), face1);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory[5].get<1>(), face3);
+  BOOST_REQUIRE_GE(strategy.sendInterestHistory.size(), 6);
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory[1].outFaceId, face1->getId());
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory[2].outFaceId, face3->getId());
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory[3].outFaceId, face2->getId());
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory[4].outFaceId, face1->getId());
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory[5].outFaceId, face3->getId());
 
   fibEntry->removeNextHop(face1);
 
-  strategy.m_sendInterestHistory.clear();
+  strategy.sendInterestHistory.clear();
   for (int i = 0; i < 3; ++i) {
     this->advanceClocks(TICK, fw::RetxSuppressionExponential::DEFAULT_MAX_INTERVAL * 2);
     pitEntry->insertOrUpdateInRecord(face5, *interest);
     strategy.afterReceiveInterest(*face5, *interest, fibEntry, pitEntry);
   }
-  BOOST_REQUIRE_EQUAL(strategy.m_sendInterestHistory.size(), 3);
-  BOOST_CHECK_NE(strategy.m_sendInterestHistory[0].get<1>(), face1);
-  BOOST_CHECK_NE(strategy.m_sendInterestHistory[1].get<1>(), face1);
-  BOOST_CHECK_NE(strategy.m_sendInterestHistory[2].get<1>(), face1);
+  BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 3);
+  BOOST_CHECK_NE(strategy.sendInterestHistory[0].outFaceId, face1->getId());
+  BOOST_CHECK_NE(strategy.sendInterestHistory[1].outFaceId, face1->getId());
+  BOOST_CHECK_NE(strategy.sendInterestHistory[2].outFaceId, face1->getId());
   // face1 cannot be used because it's gone from FIB entry
 }
 
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE(NoRouteNack) // send Nack-NoRoute if there's no usable FIB nexthop
+
+class EmptyNextHopList
+{
+public:
+  Name
+  getInterestName()
+  {
+    return "/P";
+  }
+
+  shared_ptr<fib::Entry>
+  makeFibEntry(BestRouteStrategy2Fixture* fixture)
+  {
+    return fixture->fib.insert(Name()).first;
+  }
+};
+
+class NextHopIsDownstream
+{
+public:
+  Name
+  getInterestName()
+  {
+    return "/P";
+  }
+
+  shared_ptr<fib::Entry>
+  makeFibEntry(BestRouteStrategy2Fixture* fixture)
+  {
+    shared_ptr<fib::Entry> fibEntry = fixture->fib.insert(Name()).first;
+    fibEntry->addNextHop(fixture->face1, 10);
+    return fibEntry;
+  }
+};
+
+class NextHopViolatesScope
+{
+public:
+  Name
+  getInterestName()
+  {
+    return "/localhop/P";
+  }
+
+  shared_ptr<fib::Entry>
+  makeFibEntry(BestRouteStrategy2Fixture* fixture)
+  {
+    shared_ptr<fib::Entry> fibEntry = fixture->fib.insert("/localhop").first;
+    fibEntry->addNextHop(fixture->face2, 10);
+    // face1 and face2 are both non-local; Interest from face1 cannot be forwarded to face2
+    return fibEntry;
+  }
+};
+
+typedef boost::mpl::vector<EmptyNextHopList, NextHopIsDownstream, NextHopViolatesScope> NoRouteScenarios;
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(IncomingInterest, Scenario, NoRouteScenarios)
+{
+  Scenario scenario;
+
+  shared_ptr<Interest> interest = makeInterest(scenario.getInterestName());
+  shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
+  pitEntry->insertOrUpdateInRecord(face1, *interest);
+
+  shared_ptr<fib::Entry> fibEntry = scenario.makeFibEntry(this);
+
+  strategy.afterReceiveInterest(*face1, *interest, fibEntry, pitEntry);
+
+  BOOST_REQUIRE_EQUAL(strategy.rejectPendingInterestHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory[0].pitEntry, pitEntry);
+
+  BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitEntry, pitEntry);
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].outFaceId, face1->getId());
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].header.getReason(), lp::NackReason::NO_ROUTE);
+}
+
+BOOST_AUTO_TEST_SUITE_END() // NoRouteNack
+
+BOOST_AUTO_TEST_SUITE(IncomingNack)
+
+BOOST_AUTO_TEST_CASE(OneUpstream) // one upstream, send Nack when Nack arrives
+{
+  shared_ptr<fib::Entry> fibEntry = fib.insert(Name()).first;
+  fibEntry->addNextHop(face3, 10);
+  fibEntry->addNextHop(face4, 20);
+  fibEntry->addNextHop(face5, 30);
+
+  shared_ptr<Interest> interest1 = makeInterest("/McQYjMbm", 992);
+  shared_ptr<Interest> interest2 = makeInterest("/McQYjMbm", 114);
+  shared_ptr<pit::Entry> pitEntry = pit.insert(*interest1).first;
+  pitEntry->insertOrUpdateInRecord(face1, *interest1);
+  pitEntry->insertOrUpdateInRecord(face2, *interest2);
+  pitEntry->insertOrUpdateOutRecord(face3, *interest1);
+
+  lp::Nack nack3 = makeNack("/McQYjMbm", 992, lp::NackReason::CONGESTION);
+  pitEntry->getOutRecord(*face3)->setIncomingNack(nack3);
+  strategy.afterReceiveNack(*face3, nack3, fibEntry, pitEntry);
+
+  BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 2);
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitEntry, pitEntry);
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].header.getReason(), lp::NackReason::CONGESTION);
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[1].pitEntry, pitEntry);
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[1].header.getReason(), lp::NackReason::CONGESTION);
+  std::unordered_set<FaceId> nackFaceIds{strategy.sendNackHistory[0].outFaceId,
+                                         strategy.sendNackHistory[1].outFaceId};
+  std::unordered_set<FaceId> expectedNackFaceIds{face1->getId(), face2->getId()};
+  BOOST_CHECK_EQUAL_COLLECTIONS(nackFaceIds.begin(), nackFaceIds.end(),
+                                expectedNackFaceIds.begin(), expectedNackFaceIds.end());
+}
+
+BOOST_AUTO_TEST_CASE(TwoUpstreams) // two upstreams, send Nack when both Nacks arrive
+{
+  shared_ptr<fib::Entry> fibEntry = fib.insert(Name()).first;
+  fibEntry->addNextHop(face3, 10);
+  fibEntry->addNextHop(face4, 20);
+  fibEntry->addNextHop(face5, 30);
+
+  shared_ptr<Interest> interest1 = makeInterest("/aS9FAyUV19", 286);
+  shared_ptr<pit::Entry> pitEntry = pit.insert(*interest1).first;
+  pitEntry->insertOrUpdateInRecord(face1, *interest1);
+  pitEntry->insertOrUpdateOutRecord(face3, *interest1);
+  pitEntry->insertOrUpdateOutRecord(face4, *interest1);
+
+  lp::Nack nack3 = makeNack("/aS9FAyUV19", 286, lp::NackReason::CONGESTION);
+  pitEntry->getOutRecord(*face3)->setIncomingNack(nack3);
+  strategy.afterReceiveNack(*face3, nack3, fibEntry, pitEntry);
+
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory.size(), 0); // don't send Nack until all upstreams have Nacked
+
+  lp::Nack nack4 = makeNack("/aS9FAyUV19", 286, lp::NackReason::CONGESTION);
+  pitEntry->getOutRecord(*face4)->setIncomingNack(nack4);
+  strategy.afterReceiveNack(*face4, nack4, fibEntry, pitEntry);
+
+  BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitEntry, pitEntry);
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].outFaceId, face1->getId());
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].header.getReason(), lp::NackReason::CONGESTION);
+}
+
+BOOST_AUTO_TEST_CASE(Timeout) // two upstreams, one times out, don't send Nack
+{
+  shared_ptr<fib::Entry> fibEntry = fib.insert(Name()).first;
+  fibEntry->addNextHop(face3, 10);
+  fibEntry->addNextHop(face4, 20);
+  fibEntry->addNextHop(face5, 30);
+
+  shared_ptr<Interest> interest1 = makeInterest("/sIYw0TXWDj", 115);
+  interest1->setInterestLifetime(time::milliseconds(400));
+  shared_ptr<pit::Entry> pitEntry = pit.insert(*interest1).first;
+  pitEntry->insertOrUpdateInRecord(face1, *interest1);
+  pitEntry->insertOrUpdateOutRecord(face3, *interest1);
+
+  this->advanceClocks(time::milliseconds(300));
+  shared_ptr<Interest> interest2 = makeInterest("/sIYw0TXWDj", 223);
+  pitEntry->insertOrUpdateInRecord(face1, *interest2);
+  pitEntry->insertOrUpdateOutRecord(face4, *interest2);
+
+  this->advanceClocks(time::milliseconds(200)); // face3 has timed out
+
+  lp::Nack nack4 = makeNack("/sIYw0TXWDj", 223, lp::NackReason::CONGESTION);
+  pitEntry->getOutRecord(*face4)->setIncomingNack(nack4);
+  strategy.afterReceiveNack(*face4, nack4, fibEntry, pitEntry);
+
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory.size(), 0);
+}
+
+BOOST_FIXTURE_TEST_CASE(LiveDeadlock, UnitTestTimeFixture) // #3033 note-7
+{
+  /*
+   *           /----------\
+   *           | producer |
+   *           \----------/
+   *                |
+   *              +---+
+   *              | P |
+   *              +---+
+   *                |
+   *           failed link
+   *                |
+   *              +---+
+   *              | R |
+   *              +---+
+   *             ^     ^
+   *            /       \
+   *           /         \
+   *        +---+       +---+
+   *        | B | <---> | C |
+   *        +---+       +---+
+   *          ^           ^
+   *          |           |
+   *          |           |
+   *        +---+       +---+
+   *        | A |       | D |
+   *        +---+       +---+
+   *          ^           ^
+   *          |           |
+   *  /----------\     /----------\
+   *  | consumer |     | consumer |
+   *  \----------/     \----------/
+   */
+
+  TopologyTester topo;
+  TopologyNode nodeP = topo.addForwarder("P"),
+               nodeR = topo.addForwarder("R"),
+               nodeA = topo.addForwarder("A"),
+               nodeB = topo.addForwarder("B"),
+               nodeC = topo.addForwarder("C"),
+               nodeD = topo.addForwarder("D");
+
+  for (TopologyNode node : {nodeP, nodeR, nodeA, nodeB, nodeC, nodeD}) {
+    topo.setStrategy<BestRouteStrategy2>(node);
+  }
+
+  const time::milliseconds LINK_DELAY(10);
+  shared_ptr<TopologyLink> linkPR = topo.addLink("PR", LINK_DELAY, {nodeP, nodeR}),
+                           linkRB = topo.addLink("RB", LINK_DELAY, {nodeR, nodeB}),
+                           linkRC = topo.addLink("RC", LINK_DELAY, {nodeR, nodeC}),
+                           linkBC = topo.addLink("BC", LINK_DELAY, {nodeB, nodeC}),
+                           linkBA = topo.addLink("BA", LINK_DELAY, {nodeB, nodeA}),
+                           linkCD = topo.addLink("CD", LINK_DELAY, {nodeC, nodeD});
+
+  // TODO register the prefix on R->P but then set the face DOWN
+  // topo.registerPrefix(nodeR, linkPR->getFace(nodeR), "ndn:/P", 10);
+  topo.registerPrefix(nodeB, linkRB->getFace(nodeB), "ndn:/P", 20);
+  topo.registerPrefix(nodeB, linkBC->getFace(nodeB), "ndn:/P", 30);
+  topo.registerPrefix(nodeC, linkRC->getFace(nodeC), "ndn:/P", 20);
+  topo.registerPrefix(nodeC, linkBC->getFace(nodeC), "ndn:/P", 30);
+  topo.registerPrefix(nodeA, linkBA->getFace(nodeA), "ndn:/P", 30);
+  topo.registerPrefix(nodeD, linkCD->getFace(nodeD), "ndn:/P", 30);
+
+  ndn::Face& appA = topo.addAppFace("A", nodeA)->getClientFace();
+  ndn::Face& appD = topo.addAppFace("D", nodeD)->getClientFace();
+
+  int nNacksA = 0, nNacksD = 0;
+  appA.expressInterest(Interest("/P/1"), bind([]{}), bind([&nNacksA]{ ++nNacksA; }), bind([]{}));
+  appD.expressInterest(Interest("/P/1"), bind([]{}), bind([&nNacksD]{ ++nNacksD; }), bind([]{}));
+  this->advanceClocks(time::milliseconds(1), time::milliseconds(5));
+  appA.expressInterest(Interest("/P/1"), bind([]{}), bind([&nNacksA]{ ++nNacksA; }), bind([]{}));
+  appD.expressInterest(Interest("/P/1"), bind([]{}), bind([&nNacksD]{ ++nNacksD; }), bind([]{}));
+  this->advanceClocks(time::milliseconds(1), time::milliseconds(100));
+
+  // As long as at least one Nack arrives at each client, strategy behavior is correct.
+  // Whether both Interests are Nacked is a client face behavior, not strategy behavior.
+  BOOST_CHECK_GT(nNacksA, 0);
+  BOOST_CHECK_GT(nNacksD, 0);
+}
+
+template<lp::NackReason X, lp::NackReason Y, lp::NackReason R>
+struct NackReasonCombination
+{
+  lp::NackReason
+  getX() const
+  {
+    return X;
+  }
+
+  lp::NackReason
+  getY() const
+  {
+    return Y;
+  }
+
+  lp::NackReason
+  getExpectedResult() const
+  {
+    return R;
+  }
+};
+
+typedef boost::mpl::vector<
+    NackReasonCombination<lp::NackReason::CONGESTION, lp::NackReason::CONGESTION, lp::NackReason::CONGESTION>,
+    NackReasonCombination<lp::NackReason::CONGESTION, lp::NackReason::DUPLICATE, lp::NackReason::CONGESTION>,
+    NackReasonCombination<lp::NackReason::CONGESTION, lp::NackReason::NO_ROUTE, lp::NackReason::CONGESTION>,
+    NackReasonCombination<lp::NackReason::DUPLICATE, lp::NackReason::CONGESTION, lp::NackReason::CONGESTION>,
+    NackReasonCombination<lp::NackReason::DUPLICATE, lp::NackReason::DUPLICATE, lp::NackReason::DUPLICATE>,
+    NackReasonCombination<lp::NackReason::DUPLICATE, lp::NackReason::NO_ROUTE, lp::NackReason::DUPLICATE>,
+    NackReasonCombination<lp::NackReason::NO_ROUTE, lp::NackReason::CONGESTION, lp::NackReason::CONGESTION>,
+    NackReasonCombination<lp::NackReason::NO_ROUTE, lp::NackReason::DUPLICATE, lp::NackReason::DUPLICATE>,
+    NackReasonCombination<lp::NackReason::NO_ROUTE, lp::NackReason::NO_ROUTE, lp::NackReason::NO_ROUTE>
+  > NackReasonCombinations;
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(CombineReasons, Combination, NackReasonCombinations)
+{
+  Combination combination;
+
+  shared_ptr<fib::Entry> fibEntry = fib.insert(Name()).first;
+  fibEntry->addNextHop(face3, 10);
+  fibEntry->addNextHop(face4, 20);
+  fibEntry->addNextHop(face5, 30);
+
+  shared_ptr<Interest> interest1 = makeInterest("/F6sEwB24I", 282);
+  shared_ptr<pit::Entry> pitEntry = pit.insert(*interest1).first;
+  pitEntry->insertOrUpdateInRecord(face1, *interest1);
+  pitEntry->insertOrUpdateOutRecord(face3, *interest1);
+  pitEntry->insertOrUpdateOutRecord(face4, *interest1);
+
+  lp::Nack nack3 = makeNack("/F6sEwB24I", 282, combination.getX());
+  pitEntry->getOutRecord(*face3)->setIncomingNack(nack3);
+  strategy.afterReceiveNack(*face3, nack3, fibEntry, pitEntry);
+
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory.size(), 0);
+
+  lp::Nack nack4 = makeNack("/F6sEwB24I", 282, combination.getY());
+  pitEntry->getOutRecord(*face4)->setIncomingNack(nack4);
+  strategy.afterReceiveNack(*face4, nack4, fibEntry, pitEntry);
+
+  BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitEntry, pitEntry);
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].outFaceId, face1->getId());
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].header.getReason(), combination.getExpectedResult());
+}
+
+BOOST_AUTO_TEST_SUITE_END() // IncomingNack
+
+BOOST_AUTO_TEST_SUITE_END() // TestBestRouteStrategy2
+BOOST_AUTO_TEST_SUITE_END() // Fw
 
 } // namespace tests
 } // namespace fw
diff --git a/tests/daemon/fw/client-control-strategy.t.cpp b/tests/daemon/fw/client-control-strategy.t.cpp
index ee3a362..189d42f 100644
--- a/tests/daemon/fw/client-control-strategy.t.cpp
+++ b/tests/daemon/fw/client-control-strategy.t.cpp
@@ -35,7 +35,8 @@
 
 using namespace nfd::tests;
 
-BOOST_FIXTURE_TEST_SUITE(FwClientControlStrategy, BaseFixture)
+BOOST_AUTO_TEST_SUITE(Fw)
+BOOST_FIXTURE_TEST_SUITE(TestClientControlStrategy, BaseFixture)
 
 BOOST_AUTO_TEST_CASE(Forward3)
 {
@@ -65,20 +66,20 @@
   shared_ptr<pit::Entry> pitEntry1 = pit.insert(*interest1).first;
   pitEntry1->insertOrUpdateInRecord(face4, *interest1);
 
-  strategy.m_sendInterestHistory.clear();
+  strategy.sendInterestHistory.clear();
   strategy.afterReceiveInterest(*face4, *interest1, fibEntry, pitEntry1);
-  BOOST_REQUIRE_EQUAL(strategy.m_sendInterestHistory.size(), 1);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory[0].get<1>(), face1);
+  BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory[0].outFaceId, face1->getId());
 
   // Interest without NextHopFaceId
   shared_ptr<Interest> interest2 = makeInterest("ndn:/y6JQADGVz");
   shared_ptr<pit::Entry> pitEntry2 = pit.insert(*interest2).first;
   pitEntry2->insertOrUpdateInRecord(face4, *interest2);
 
-  strategy.m_sendInterestHistory.clear();
+  strategy.sendInterestHistory.clear();
   strategy.afterReceiveInterest(*face4, *interest2, fibEntry, pitEntry2);
-  BOOST_REQUIRE_EQUAL(strategy.m_sendInterestHistory.size(), 1);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory[0].get<1>(), face2);
+  BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory[0].outFaceId, face2->getId());
 
   // Interest with invalid NextHopFaceId
   shared_ptr<Interest> interest3 = makeInterest("ndn:/0z8r6yDDe");
@@ -87,14 +88,15 @@
   pitEntry3->insertOrUpdateInRecord(face4, *interest3);
 
   face3->close(); // face3 is closed and its FaceId becomes invalid
-  strategy.m_sendInterestHistory.clear();
-  strategy.m_rejectPendingInterestHistory.clear();
+  strategy.sendInterestHistory.clear();
+  strategy.rejectPendingInterestHistory.clear();
   strategy.afterReceiveInterest(*face4, *interest3, fibEntry, pitEntry3);
-  BOOST_REQUIRE_EQUAL(strategy.m_sendInterestHistory.size(), 0);
-  BOOST_REQUIRE_EQUAL(strategy.m_rejectPendingInterestHistory.size(), 1);
+  BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 0);
+  BOOST_REQUIRE_EQUAL(strategy.rejectPendingInterestHistory.size(), 1);
 }
 
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestClientControlStrategy
+BOOST_AUTO_TEST_SUITE_END() // Fw
 
 } // namespace tests
 } // namespace fw
diff --git a/tests/daemon/fw/dummy-strategy.hpp b/tests/daemon/fw/dummy-strategy.hpp
index d078051..33d2656 100644
--- a/tests/daemon/fw/dummy-strategy.hpp
+++ b/tests/daemon/fw/dummy-strategy.hpp
@@ -33,7 +33,7 @@
 
 /** \brief strategy for unit testing
  *
- *  Triggers on DummyStrategy are recorded but does nothing
+ *  Unless otherwise indicated, triggers are recorded but does nothing.
  */
 class DummyStrategy : public fw::Strategy
 {
@@ -47,9 +47,13 @@
   {
   }
 
+  /** \brief after receive Interest trigger
+   *
+   *  If \p interestOutFace is not null, send Interest action is invoked with that face;
+   *  otherwise, reject pending Interest action is invoked.
+   */
   virtual void
-  afterReceiveInterest(const Face& inFace,
-                       const Interest& interest,
+  afterReceiveInterest(const Face& inFace, const Interest& interest,
                        shared_ptr<fib::Entry> fibEntry,
                        shared_ptr<pit::Entry> pitEntry) DECL_OVERRIDE
   {
@@ -59,7 +63,7 @@
         interest, fibEntry, pitEntry));
     }
 
-    if (static_cast<bool>(interestOutFace)) {
+    if (interestOutFace) {
       this->sendInterest(pitEntry, interestOutFace);
     }
     else {
@@ -80,16 +84,25 @@
     ++beforeExpirePendingInterest_count;
   }
 
+  virtual void
+  afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+                   shared_ptr<fib::Entry> fibEntry,
+                   shared_ptr<pit::Entry> pitEntry) DECL_OVERRIDE
+  {
+    ++afterReceiveNack_count;
+  }
+
 public:
   int afterReceiveInterest_count;
   bool wantAfterReceiveInterestCalls;
   std::vector<std::tuple<FaceId, Interest, shared_ptr<fib::Entry>,
               shared_ptr<pit::Entry>>> afterReceiveInterestCalls;
+  shared_ptr<Face> interestOutFace;
+
   int beforeSatisfyInterest_count;
   int beforeExpirePendingInterest_count;
+  int afterReceiveNack_count;
 
-  /// outFace to use in afterReceiveInterest, nullptr to reject
-  shared_ptr<Face> interestOutFace;
 };
 
 } // namespace tests
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index d9d50d6..6a3509f 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.t.cpp
@@ -25,6 +25,8 @@
 
 #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"
@@ -425,6 +427,225 @@
   BOOST_CHECK_EQUAL(face4->m_sentDatas.size(), 1);
 }
 
+BOOST_AUTO_TEST_CASE(IncomingNack)
+{
+  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));
+  forwarder.addFace(face1);
+  forwarder.addFace(face2);
+  forwarder.addFace(face3);
+
+  StrategyChoice& strategyChoice = forwarder.getStrategyChoice();
+  shared_ptr<DummyStrategy> strategyP = make_shared<DummyStrategy>(
+                                        ref(forwarder), "ndn:/strategyP");
+  shared_ptr<DummyStrategy> strategyQ = make_shared<DummyStrategy>(
+                                        ref(forwarder), "ndn:/strategyQ");
+  strategyChoice.install(strategyP);
+  strategyChoice.install(strategyQ);
+  strategyChoice.insert("ndn:/" , strategyP->getName());
+  strategyChoice.insert("ndn:/B", strategyQ->getName());
+
+  Pit& pit = forwarder.getPit();
+
+  // dispatch to the correct strategy
+  shared_ptr<Interest> interest1 = makeInterest("/A/AYJqayrzF", 562);
+  shared_ptr<pit::Entry> pit1 = pit.insert(*interest1).first;
+  pit1->insertOrUpdateOutRecord(face1, *interest1);
+  shared_ptr<Interest> interest2 = makeInterest("/B/EVyP73ru", 221);
+  shared_ptr<pit::Entry> pit2 = pit.insert(*interest2).first;
+  pit2->insertOrUpdateOutRecord(face1, *interest2);
+
+  lp::Nack nack1 = makeNack("/A/AYJqayrzF", 562, lp::NackReason::CONGESTION);
+  strategyP->afterReceiveNack_count = 0;
+  strategyQ->afterReceiveNack_count = 0;
+  forwarder.onIncomingNack(*face1, nack1);
+  BOOST_CHECK_EQUAL(strategyP->afterReceiveNack_count, 1);
+  BOOST_CHECK_EQUAL(strategyQ->afterReceiveNack_count, 0);
+
+  lp::Nack nack2 = makeNack("/B/EVyP73ru", 221, lp::NackReason::CONGESTION);
+  strategyP->afterReceiveNack_count = 0;
+  strategyQ->afterReceiveNack_count = 0;
+  forwarder.onIncomingNack(*face1, nack2);
+  BOOST_CHECK_EQUAL(strategyP->afterReceiveNack_count, 0);
+  BOOST_CHECK_EQUAL(strategyQ->afterReceiveNack_count, 1);
+
+  // record Nack on PIT out-record
+  pit::OutRecordCollection::const_iterator outRecord1 = pit1->getOutRecord(*face1);
+  BOOST_REQUIRE(outRecord1 != pit1->getOutRecords().end());
+  BOOST_REQUIRE(outRecord1->getIncomingNack() != nullptr);
+  BOOST_CHECK_EQUAL(outRecord1->getIncomingNack()->getReason(), lp::NackReason::CONGESTION);
+
+  // drop if no PIT entry
+  lp::Nack nack3 = makeNack("/yEcw5HhdM", 243, lp::NackReason::CONGESTION);
+  strategyP->afterReceiveNack_count = 0;
+  strategyQ->afterReceiveNack_count = 0;
+  forwarder.onIncomingNack(*face1, nack3);
+  BOOST_CHECK_EQUAL(strategyP->afterReceiveNack_count, 0);
+  BOOST_CHECK_EQUAL(strategyQ->afterReceiveNack_count, 0);
+
+  // drop if no out-record
+  shared_ptr<Interest> interest4 = makeInterest("/Etab4KpY", 157);
+  shared_ptr<pit::Entry> pit4 = pit.insert(*interest4).first;
+  pit4->insertOrUpdateOutRecord(face1, *interest4);
+
+  lp::Nack nack4a = makeNack("/Etab4KpY", 157, lp::NackReason::CONGESTION);
+  strategyP->afterReceiveNack_count = 0;
+  strategyQ->afterReceiveNack_count = 0;
+  forwarder.onIncomingNack(*face2, nack4a);
+  BOOST_CHECK_EQUAL(strategyP->afterReceiveNack_count, 0);
+  BOOST_CHECK_EQUAL(strategyQ->afterReceiveNack_count, 0);
+
+  // drop if Nonce does not match out-record
+  lp::Nack nack4b = makeNack("/Etab4KpY", 294, lp::NackReason::CONGESTION);
+  strategyP->afterReceiveNack_count = 0;
+  strategyQ->afterReceiveNack_count = 0;
+  forwarder.onIncomingNack(*face1, nack4b);
+  BOOST_CHECK_EQUAL(strategyP->afterReceiveNack_count, 0);
+  BOOST_CHECK_EQUAL(strategyQ->afterReceiveNack_count, 0);
+
+  // drop if inFace is multi-access
+  pit4->insertOrUpdateOutRecord(face3, *interest4);
+  strategyP->afterReceiveNack_count = 0;
+  strategyQ->afterReceiveNack_count = 0;
+  forwarder.onIncomingNack(*face3, nack4a);
+  BOOST_CHECK_EQUAL(strategyP->afterReceiveNack_count, 0);
+  BOOST_CHECK_EQUAL(strategyQ->afterReceiveNack_count, 0);
+}
+
+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
+
+  Pit& pit = forwarder.getPit();
+
+  lp::NackHeader nackHeader;
+  nackHeader.setReason(lp::NackReason::CONGESTION);
+
+  // 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);
+
+  face2->sentNacks.clear();
+  forwarder.onOutgoingNack(pit1, *face2w, 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);
+  shared_ptr<Interest> interest2b = makeInterest("/Vi8tRm9MG3", 808);
+  pit2->insertOrUpdateInRecord(face2w, *interest2b);
+
+  face1->sentNacks.clear();
+  forwarder.onOutgoingNack(pit2, *face1w, 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);
+  BOOST_CHECK(inRecord2a == pit2->getInRecords().end());
+
+  // send Nack with correct Nonce
+  face2->sentNacks.clear();
+  forwarder.onOutgoingNack(pit2, *face2w, 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);
+  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);
+
+  face3->sentNacks.clear();
+  forwarder.onOutgoingNack(pit1, *face3w, 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 face4 = make_shared<DummyFace>();
+  forwarder.addFace(face1w);
+  forwarder.addFace(face2w);
+  forwarder.addFace(face3w);
+  forwarder.addFace(face4);
+  // TODO#3172 eliminate wrapper
+
+  Fib& fib = forwarder.getFib();
+  shared_ptr<fib::Entry> fibEntry = fib.insert(Name("/zT4XwK0Hnx")).first;
+  fibEntry->addNextHop(face4, 0);
+
+  // receive Interest on face1
+  face1->sentNacks.clear();
+  shared_ptr<Interest> interest1a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", 732);
+  face1->receiveInterest(*interest1a);
+  BOOST_CHECK(face1->sentNacks.empty());
+
+  // receive Interest with duplicate Nonce on face1
+  face1->sentNacks.clear();
+  shared_ptr<Interest> interest1b = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", 732);
+  face1->receiveInterest(*interest1b);
+  BOOST_REQUIRE_EQUAL(face1->sentNacks.size(), 1);
+  BOOST_CHECK_EQUAL(face1->sentNacks.back().getInterest(), *interest1b);
+  BOOST_CHECK_EQUAL(face1->sentNacks.back().getReason(), lp::NackReason::DUPLICATE);
+
+  // receive Interest with duplicate Nonce on face2
+  face2->sentNacks.clear();
+  shared_ptr<Interest> interest2a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", 732);
+  face2->receiveInterest(*interest2a);
+  BOOST_REQUIRE_EQUAL(face2->sentNacks.size(), 1);
+  BOOST_CHECK_EQUAL(face2->sentNacks.back().getInterest(), *interest2a);
+  BOOST_CHECK_EQUAL(face2->sentNacks.back().getReason(), lp::NackReason::DUPLICATE);
+
+  // receive Interest with new Nonce on face2
+  face2->sentNacks.clear();
+  shared_ptr<Interest> interest2b = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", 944);
+  face2->receiveInterest(*interest2b);
+  BOOST_CHECK(face2->sentNacks.empty());
+
+  // receive Interest with duplicate Nonce on face3, don't send Nack to multi-access face
+  face3->sentNacks.clear();
+  shared_ptr<Interest> interest3a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", 732);
+  face3->receiveInterest(*interest3a);
+  BOOST_CHECK(face3->sentNacks.empty());
+}
+
 BOOST_FIXTURE_TEST_CASE(InterestLoopWithShortLifetime, UnitTestTimeFixture) // Bug 1953
 {
   Forwarder forwarder;
diff --git a/tests/daemon/fw/multicast-strategy.t.cpp b/tests/daemon/fw/multicast-strategy.t.cpp
index c67c408..3476cd3 100644
--- a/tests/daemon/fw/multicast-strategy.t.cpp
+++ b/tests/daemon/fw/multicast-strategy.t.cpp
@@ -35,7 +35,8 @@
 
 using namespace nfd::tests;
 
-BOOST_FIXTURE_TEST_SUITE(FwMulticastStrategy, BaseFixture)
+BOOST_AUTO_TEST_SUITE(Fw)
+BOOST_FIXTURE_TEST_SUITE(TestMulticastStrategy, BaseFixture)
 
 BOOST_AUTO_TEST_CASE(Forward2)
 {
@@ -62,21 +63,17 @@
   pitEntry->insertOrUpdateInRecord(face3, *interest);
 
   strategy.afterReceiveInterest(*face3, *interest, fibEntry, pitEntry);
-  BOOST_CHECK_EQUAL(strategy.m_rejectPendingInterestHistory.size(), 0);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory.size(), 2);
-  bool hasFace1 = false;
-  bool hasFace2 = false;
-  for (std::vector<MulticastStrategyTester::SendInterestArgs>::iterator it =
-       strategy.m_sendInterestHistory.begin();
-       it != strategy.m_sendInterestHistory.end(); ++it) {
-    if (it->get<1>() == face1) {
-      hasFace1 = true;
-    }
-    if (it->get<1>() == face2) {
-      hasFace2 = true;
-    }
-  }
-  BOOST_CHECK(hasFace1 && hasFace2);
+  BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 2);
+  std::set<FaceId> sentInterestFaceIds;
+  std::transform(strategy.sendInterestHistory.begin(), strategy.sendInterestHistory.end(),
+                 std::inserter(sentInterestFaceIds, sentInterestFaceIds.end()),
+                 [] (const MulticastStrategyTester::SendInterestArgs& args) {
+                   return args.outFaceId;
+                 });
+  std::set<FaceId> expectedInterestFaceIds{face1->getId(), face2->getId()};
+  BOOST_CHECK_EQUAL_COLLECTIONS(sentInterestFaceIds.begin(), sentInterestFaceIds.end(),
+                                expectedInterestFaceIds.begin(), expectedInterestFaceIds.end());
 }
 
 BOOST_AUTO_TEST_CASE(RejectScope)
@@ -100,8 +97,8 @@
   pitEntry->insertOrUpdateInRecord(face1, *interest);
 
   strategy.afterReceiveInterest(*face1, *interest, fibEntry, pitEntry);
-  BOOST_CHECK_EQUAL(strategy.m_rejectPendingInterestHistory.size(), 1);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory.size(), 0);
+  BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 0);
 }
 
 BOOST_AUTO_TEST_CASE(RejectLoopback)
@@ -123,11 +120,12 @@
   pitEntry->insertOrUpdateInRecord(face1, *interest);
 
   strategy.afterReceiveInterest(*face1, *interest, fibEntry, pitEntry);
-  BOOST_CHECK_EQUAL(strategy.m_rejectPendingInterestHistory.size(), 1);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory.size(), 0);
+  BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 0);
 }
 
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestMulticastStrategy
+BOOST_AUTO_TEST_SUITE_END() // Fw
 
 } // namespace tests
 } // namespace fw
diff --git a/tests/daemon/fw/ncc-strategy.t.cpp b/tests/daemon/fw/ncc-strategy.t.cpp
index a10fc47..889b2e2 100644
--- a/tests/daemon/fw/ncc-strategy.t.cpp
+++ b/tests/daemon/fw/ncc-strategy.t.cpp
@@ -36,7 +36,8 @@
 
 using namespace nfd::tests;
 
-BOOST_FIXTURE_TEST_SUITE(FwNccStrategy, UnitTestTimeFixture)
+BOOST_AUTO_TEST_SUITE(Fw)
+BOOST_FIXTURE_TEST_SUITE(TestNccStrategy, UnitTestTimeFixture)
 
 // NccStrategy is fairly complex.
 // The most important property is:
@@ -48,7 +49,7 @@
   Forwarder forwarder;
   typedef StrategyTester<fw::NccStrategy> NccStrategyTester;
   shared_ptr<NccStrategyTester> strategy = make_shared<NccStrategyTester>(ref(forwarder));
-  strategy->onAction.connect(bind(&LimitedIo::afterOp, &limitedIo));
+  strategy->afterAction.connect(bind(&LimitedIo::afterOp, &limitedIo));
 
   shared_ptr<DummyFace> face1 = make_shared<DummyFace>();
   shared_ptr<DummyFace> face2 = make_shared<DummyFace>();
@@ -79,13 +80,13 @@
 
   // forwards to face1 because routing says it's best
   // (no io run here: afterReceiveInterest has already sent the Interest)
-  BOOST_REQUIRE_EQUAL(strategy->m_sendInterestHistory.size(), 1);
-  BOOST_CHECK_EQUAL(strategy->m_sendInterestHistory[0].get<1>(), face1);
+  BOOST_REQUIRE_EQUAL(strategy->sendInterestHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy->sendInterestHistory[0].outFaceId, face1->getId());
 
   // forwards to face2 because face1 doesn't respond
   limitedIo.run(1, time::milliseconds(500), time::milliseconds(10));
-  BOOST_REQUIRE_EQUAL(strategy->m_sendInterestHistory.size(), 2);
-  BOOST_CHECK_EQUAL(strategy->m_sendInterestHistory[1].get<1>(), face2);
+  BOOST_REQUIRE_EQUAL(strategy->sendInterestHistory.size(), 2);
+  BOOST_CHECK_EQUAL(strategy->sendInterestHistory[1].outFaceId, face2->getId());
 
   // face2 responds
   shared_ptr<Data> data1p = makeData("ndn:/0Jm1ajrW/%00");
@@ -104,8 +105,8 @@
 
   // forwards to face2 because it responds previously
   this->advanceClocks(time::milliseconds(1));
-  BOOST_REQUIRE_GE(strategy->m_sendInterestHistory.size(), 3);
-  BOOST_CHECK_EQUAL(strategy->m_sendInterestHistory[2].get<1>(), face2);
+  BOOST_REQUIRE_GE(strategy->sendInterestHistory.size(), 3);
+  BOOST_CHECK_EQUAL(strategy->sendInterestHistory[2].outFaceId, face2->getId());
 }
 
 BOOST_AUTO_TEST_CASE(Bug1853)
@@ -140,8 +141,8 @@
   strategy->afterReceiveInterest(*face3, *interest1, fibEntry, pitEntry1);
 
   this->advanceClocks(time::milliseconds(1));
-  BOOST_REQUIRE_EQUAL(strategy->m_sendInterestHistory.size(), 1);
-  BOOST_CHECK_EQUAL(strategy->m_sendInterestHistory[0].get<1>(), face1);
+  BOOST_REQUIRE_EQUAL(strategy->sendInterestHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy->sendInterestHistory[0].outFaceId, face1->getId());
 
   // face1 responds
   shared_ptr<Data> data1 = makeData("ndn:/nztwIvHX/%00");
@@ -168,7 +169,7 @@
   Forwarder forwarder;
   typedef StrategyTester<fw::NccStrategy> NccStrategyTester;
   shared_ptr<NccStrategyTester> strategy = make_shared<NccStrategyTester>(ref(forwarder));
-  strategy->onAction.connect(bind(&LimitedIo::afterOp, &limitedIo));
+  strategy->afterAction.connect(bind(&LimitedIo::afterOp, &limitedIo));
 
   shared_ptr<DummyFace> face1 = make_shared<DummyFace>();
   shared_ptr<DummyFace> face2 = make_shared<DummyFace>();
@@ -195,11 +196,11 @@
 
   pitEntry1->insertOrUpdateInRecord(face3, *interest1);
   strategy->afterReceiveInterest(*face3, *interest1, fibEntry, pitEntry1);
-  limitedIo.run(2 - strategy->m_sendInterestHistory.size(),
+  limitedIo.run(2 - strategy->sendInterestHistory.size(),
                 time::milliseconds(2000), time::milliseconds(10));
-  BOOST_REQUIRE_EQUAL(strategy->m_sendInterestHistory.size(), 2);
-  BOOST_CHECK_EQUAL(strategy->m_sendInterestHistory[0].get<1>(), face1);
-  BOOST_CHECK_EQUAL(strategy->m_sendInterestHistory[1].get<1>(), face2);
+  BOOST_REQUIRE_EQUAL(strategy->sendInterestHistory.size(), 2);
+  BOOST_CHECK_EQUAL(strategy->sendInterestHistory[0].outFaceId, face1->getId());
+  BOOST_CHECK_EQUAL(strategy->sendInterestHistory[1].outFaceId, face2->getId());
 
   // face1 responds
   shared_ptr<Data> data1 = makeData("ndn:/seRMz5a6/%00");
@@ -217,11 +218,11 @@
 
   pitEntry2->insertOrUpdateInRecord(face3, *interest2);
   strategy->afterReceiveInterest(*face3, *interest2, fibEntry, pitEntry2);
-  limitedIo.run(3 - strategy->m_sendInterestHistory.size(),
+  limitedIo.run(3 - strategy->sendInterestHistory.size(),
                 time::milliseconds(2000), time::milliseconds(10));
 
-  BOOST_REQUIRE_GE(strategy->m_sendInterestHistory.size(), 3);
-  BOOST_CHECK_EQUAL(strategy->m_sendInterestHistory[2].get<1>(), face1);
+  BOOST_REQUIRE_GE(strategy->sendInterestHistory.size(), 3);
+  BOOST_CHECK_EQUAL(strategy->sendInterestHistory[2].outFaceId, face1->getId());
 }
 
 BOOST_AUTO_TEST_CASE(Bug1971)
@@ -230,7 +231,7 @@
   Forwarder forwarder;
   typedef StrategyTester<fw::NccStrategy> NccStrategyTester;
   shared_ptr<NccStrategyTester> strategy = make_shared<NccStrategyTester>(ref(forwarder));
-  strategy->onAction.connect(bind(&LimitedIo::afterOp, &limitedIo));
+  strategy->afterAction.connect(bind(&LimitedIo::afterOp, &limitedIo));
 
   shared_ptr<DummyFace> face1 = make_shared<DummyFace>();
   shared_ptr<DummyFace> face2 = make_shared<DummyFace>();
@@ -254,10 +255,10 @@
 
   pitEntry1->insertOrUpdateInRecord(face1, *interest1);
   strategy->afterReceiveInterest(*face1, *interest1, fibEntry, pitEntry1);
-  limitedIo.run(1 - strategy->m_sendInterestHistory.size(),
+  limitedIo.run(1 - strategy->sendInterestHistory.size(),
                 time::milliseconds(2000), time::milliseconds(10));
-  BOOST_REQUIRE_EQUAL(strategy->m_sendInterestHistory.size(), 1);
-  BOOST_CHECK_EQUAL(strategy->m_sendInterestHistory[0].get<1>(), face2);
+  BOOST_REQUIRE_EQUAL(strategy->sendInterestHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy->sendInterestHistory[0].outFaceId, face2->getId());
 
   // face2 responds
   shared_ptr<Data> data1 = makeData("ndn:/M4mBXCsd");
@@ -270,10 +271,10 @@
   // similar Interest: strategy should still forward it
   pitEntry1->insertOrUpdateInRecord(face1, *interest1);
   strategy->afterReceiveInterest(*face1, *interest1, fibEntry, pitEntry1);
-  limitedIo.run(2 - strategy->m_sendInterestHistory.size(),
+  limitedIo.run(2 - strategy->sendInterestHistory.size(),
                 time::milliseconds(2000), time::milliseconds(10));
-  BOOST_REQUIRE_EQUAL(strategy->m_sendInterestHistory.size(), 2);
-  BOOST_CHECK_EQUAL(strategy->m_sendInterestHistory[1].get<1>(), face2);
+  BOOST_REQUIRE_EQUAL(strategy->sendInterestHistory.size(), 2);
+  BOOST_CHECK_EQUAL(strategy->sendInterestHistory[1].outFaceId, face2->getId());
 }
 
 BOOST_AUTO_TEST_CASE(Bug1998)
@@ -306,11 +307,12 @@
   strategy->afterReceiveInterest(*face1, *interest1, fibEntry, pitEntry1);
 
   // Interest shall go to face2, not loop back to face1
-  BOOST_REQUIRE_EQUAL(strategy->m_sendInterestHistory.size(), 1);
-  BOOST_CHECK_EQUAL(strategy->m_sendInterestHistory[0].get<1>(), face2);
+  BOOST_REQUIRE_EQUAL(strategy->sendInterestHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy->sendInterestHistory[0].outFaceId, face2->getId());
 }
 
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestNccStrategy
+BOOST_AUTO_TEST_SUITE_END() // Fw
 
 } // namespace tests
 } // namespace fw
diff --git a/tests/daemon/fw/retx-suppression.t.cpp b/tests/daemon/fw/retx-suppression.t.cpp
index 2d1b146..266f168 100644
--- a/tests/daemon/fw/retx-suppression.t.cpp
+++ b/tests/daemon/fw/retx-suppression.t.cpp
@@ -26,7 +26,6 @@
 #include "fw/retx-suppression.hpp"
 #include "fw/retx-suppression-fixed.hpp"
 #include "fw/retx-suppression-exponential.hpp"
-#include "strategy-tester.hpp"
 
 #include "tests/test-common.hpp"
 #include "tests/daemon/face/dummy-face.hpp"
diff --git a/tests/daemon/fw/strategy-tester.hpp b/tests/daemon/fw/strategy-tester.hpp
index 9cf4855..26c29c1 100644
--- a/tests/daemon/fw/strategy-tester.hpp
+++ b/tests/daemon/fw/strategy-tester.hpp
@@ -33,8 +33,7 @@
 namespace fw {
 namespace tests {
 
-/** \class StrategyTester
- *  \brief extends strategy S for unit testing
+/** \brief extends strategy S for unit testing
  *
  *  Actions invoked by S are recorded but not passed to forwarder
  */
@@ -49,7 +48,7 @@
   }
 
   /// fires after each Action
-  signal::Signal<StrategyTester<S>> onAction;
+  signal::Signal<StrategyTester<S>> afterAction;
 
 protected:
   virtual void
@@ -60,12 +59,32 @@
   virtual void
   rejectPendingInterest(shared_ptr<pit::Entry> pitEntry) DECL_OVERRIDE;
 
-public:
-  typedef boost::tuple<shared_ptr<pit::Entry>, shared_ptr<Face>> SendInterestArgs;
-  std::vector<SendInterestArgs> m_sendInterestHistory;
+  virtual void
+  sendNack(shared_ptr<pit::Entry> pitEntry, const Face& outFace,
+           const lp::NackHeader& header) DECL_OVERRIDE;
 
-  typedef boost::tuple<shared_ptr<pit::Entry>> RejectPendingInterestArgs;
-  std::vector<RejectPendingInterestArgs> m_rejectPendingInterestHistory;
+public:
+  struct SendInterestArgs
+  {
+    shared_ptr<pit::Entry> pitEntry;
+    FaceId outFaceId;
+    bool wantNewNonce;
+  };
+  std::vector<SendInterestArgs> sendInterestHistory;
+
+  struct RejectPendingInterestArgs
+  {
+    shared_ptr<pit::Entry> pitEntry;
+  };
+  std::vector<RejectPendingInterestArgs> rejectPendingInterestHistory;
+
+  struct SendNackArgs
+  {
+    shared_ptr<pit::Entry> pitEntry;
+    FaceId outFaceId;
+    lp::NackHeader header;
+  };
+  std::vector<SendNackArgs> sendNackHistory;
 };
 
 
@@ -75,17 +94,30 @@
                                 shared_ptr<Face> outFace,
                                 bool wantNewNonce)
 {
-  m_sendInterestHistory.push_back(SendInterestArgs(pitEntry, outFace));
+  SendInterestArgs args{pitEntry, outFace->getId()};
+  sendInterestHistory.push_back(args);
   pitEntry->insertOrUpdateOutRecord(outFace, pitEntry->getInterest());
-  onAction();
+  afterAction();
 }
 
 template<typename S>
 inline void
 StrategyTester<S>::rejectPendingInterest(shared_ptr<pit::Entry> pitEntry)
 {
-  m_rejectPendingInterestHistory.push_back(RejectPendingInterestArgs(pitEntry));
-  onAction();
+  RejectPendingInterestArgs args{pitEntry};
+  rejectPendingInterestHistory.push_back(args);
+  afterAction();
+}
+
+template<typename S>
+inline void
+StrategyTester<S>::sendNack(shared_ptr<pit::Entry> pitEntry, const Face& outFace,
+                            const lp::NackHeader& header)
+{
+  SendNackArgs args{pitEntry, outFace.getId(), header};
+  sendNackHistory.push_back(args);
+  pitEntry->deleteInRecord(outFace);
+  afterAction();
 }
 
 } // namespace tests
diff --git a/tests/daemon/fw/topology-tester.cpp b/tests/daemon/fw/topology-tester.cpp
new file mode 100644
index 0000000..10a0b31
--- /dev/null
+++ b/tests/daemon/fw/topology-tester.cpp
@@ -0,0 +1,260 @@
+/* -*- 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 "topology-tester.hpp"
+#include <ndn-cxx/encoding/encoding-buffer-fwd.hpp>
+#include "face/generic-link-service.hpp"
+
+namespace nfd {
+namespace fw {
+namespace tests {
+
+using face::LpFaceWrapper;
+
+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()
+  : m_isUp(true)
+{
+}
+
+void
+TopologyLinkBase::attachTransport(TopologyNode i, TopologyTransportBase* transport)
+{
+  BOOST_ASSERT(transport != nullptr);
+  BOOST_ASSERT(m_transports.count(i) == 0);
+
+  m_transports[i] = transport;
+  transport->afterSend.connect([this, i] (const Block& packet) { this->transmit(i, packet); });
+}
+
+void
+TopologyLinkBase::transmit(TopologyNode i, const Block& packet)
+{
+  if (!m_isUp) {
+    return;
+  }
+
+  for (auto&& p : m_transports) {
+    if (p.first == i) {
+      continue;
+    }
+
+    TopologyTransportBase* 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)
+{
+  scheduler::schedule(m_delay, [packet, recipient] {
+    recipient->receiveFromTopology(packet);
+  });
+}
+
+TopologyAppLink::TopologyAppLink(shared_ptr<LpFaceWrapper> face)
+  : m_face(face)
+{
+  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());
+}
+
+void
+TopologyAppLink::scheduleReceive(TopologyTransportBase* recipient, const Block& packet)
+{
+  getGlobalIoService().post([packet, recipient] {
+    recipient->receiveFromTopology(packet);
+  });
+}
+
+TopologyNode
+TopologyTester::addForwarder(const std::string& label)
+{
+  size_t i = m_forwarders.size();
+  m_forwarders.push_back(std::move(make_unique<Forwarder>()));
+  m_forwarderLabels.push_back(label);
+  BOOST_ASSERT(m_forwarders.size() == m_forwarderLabels.size());
+  return i;
+}
+
+shared_ptr<TopologyLink>
+TopologyTester::addLink(const std::string& label, const time::nanoseconds& delay,
+                        std::initializer_list<TopologyNode> forwarders,
+                        bool forceMultiAccessFace)
+{
+  auto link = make_shared<TopologyLink>(delay);
+  FaceUri remoteUri("topology://link/" + label);
+  ndn::nfd::LinkType linkType = (forceMultiAccessFace || forwarders.size() > 2) ?
+                                ndn::nfd::LINK_TYPE_MULTI_ACCESS :
+                                ndn::nfd::LINK_TYPE_POINT_TO_POINT;
+
+  for (TopologyNode i : forwarders) {
+    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,
+                     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));
+
+    forwarder.addFace(faceW);
+    link->addFace(i, faceW);
+  }
+
+  m_links.push_back(link); // keep a shared_ptr so callers don't have to
+  return link;
+}
+
+shared_ptr<TopologyAppLink>
+TopologyTester::addAppFace(const std::string& label, TopologyNode i)
+{
+  Forwarder& forwarder = this->getForwarder(i);
+  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,
+                   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));
+
+  forwarder.addFace(faceW);
+
+  auto al = make_shared<TopologyAppLink>(faceW);
+  m_appLinks.push_back(al); // keep a shared_ptr so callers don't have to
+  return al;
+}
+
+shared_ptr<TopologyAppLink>
+TopologyTester::addAppFace(const std::string& label, TopologyNode i, const Name& prefix, uint64_t cost)
+{
+  shared_ptr<TopologyAppLink> al = this->addAppFace(label, i);
+  this->registerPrefix(i, al->getForwarderFace(), prefix, cost);
+  return al;
+}
+
+void
+TopologyTester::registerPrefix(TopologyNode i, const Face& face, const Name& prefix, uint64_t cost)
+{
+  Forwarder& forwarder = this->getForwarder(i);
+  Fib& fib = forwarder.getFib();
+  shared_ptr<fib::Entry> fibEntry = fib.insert(prefix).first;
+  fibEntry->addNextHop(const_cast<Face&>(face).shared_from_this(), cost);
+}
+
+void
+TopologyTester::addEchoProducer(ndn::Face& face, const Name& prefix)
+{
+  face.setInterestFilter(prefix,
+      [&face] (const ndn::InterestFilter&, const Interest& interest) {
+        shared_ptr<Data> data = makeData(interest.getName());
+        face.put(*data);
+      });
+}
+
+void
+TopologyTester::addIntervalConsumer(ndn::Face& face, const Name& prefix,
+                                    const time::nanoseconds& interval, size_t n)
+{
+  Name name(prefix);
+  name.appendTimestamp();
+  shared_ptr<Interest> interest = makeInterest(name);
+  face.expressInterest(*interest, bind([]{}));
+
+  if (n > 1) {
+    scheduler::schedule(interval, bind(&TopologyTester::addIntervalConsumer, this,
+                                       ref(face), prefix, interval, n - 1));
+  }
+}
+
+} // namespace tests
+} // namespace fw
+} // namespace nfd
diff --git a/tests/daemon/fw/topology-tester.hpp b/tests/daemon/fw/topology-tester.hpp
index 406c6b1..dd6d77d 100644
--- a/tests/daemon/fw/topology-tester.hpp
+++ b/tests/daemon/fw/topology-tester.hpp
@@ -30,19 +30,86 @@
 #ifndef NFD_TESTS_NFD_FW_TOPOLOGY_TESTER_HPP
 #define NFD_TESTS_NFD_FW_TOPOLOGY_TESTER_HPP
 
-#include <unordered_map>
-#include <ndn-cxx/util/dummy-client-face.hpp>
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/transport/transport.hpp>
+#include "face/lp-face-wrapper.hpp"
 #include "fw/strategy.hpp"
 #include "tests/test-common.hpp"
-#include "../face/dummy-face.hpp"
 
 namespace nfd {
 namespace fw {
 namespace tests {
 
-using ndn::util::DummyClientFace;
 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;
@@ -52,10 +119,7 @@
 class TopologyLinkBase : noncopyable
 {
 public:
-  TopologyLinkBase()
-    : m_isUp(true)
-  {
-  }
+  TopologyLinkBase();
 
   /** \brief fail the link, cause packets to be dropped silently
    */
@@ -74,7 +138,21 @@
   }
 
 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
@@ -82,90 +160,27 @@
 class TopologyLink : public TopologyLinkBase
 {
 public:
+  explicit
+  TopologyLink(const time::nanoseconds& delay);
+
+  void
+  addFace(TopologyNode i, shared_ptr<face::LpFaceWrapper> face);
+
   /** \return a face of forwarder \p i which is attached to this link
    */
-  shared_ptr<DummyFace>
+  Face&
   getFace(TopologyNode i)
   {
-    return m_faces.at(i)->face;
+    return *m_faces.at(i);
   }
 
 private:
-  explicit
-  TopologyLink(const time::nanoseconds& delay)
-    : m_delay(delay)
-  {
-    BOOST_ASSERT(delay >= time::nanoseconds::zero());
-  }
-
-  struct LinkFace
-  {
-    shared_ptr<DummyFace> face;
-  };
-
-  void
-  addFace(TopologyNode i, shared_ptr<DummyFace> face)
-  {
-    BOOST_ASSERT(m_faces.count(i) == 0);
-
-    LinkFace* lf = new LinkFace();
-    lf->face = face;
-    face->onSendInterest.connect(bind(&TopologyLink::transmitInterest, this, i, _1));
-    face->onSendData.connect(bind(&TopologyLink::transmitData, this, i, _1));
-
-    m_faces[i].reset(lf);
-  }
-
-  friend class TopologyTester;
-
-private:
-  void
-  transmitInterest(TopologyNode i, const Interest& interest)
-  {
-    if (!m_isUp) {
-      return;
-    }
-
-    // Interest object cannot be shared between faces because
-    // Forwarder can set different IncomingFaceId.
-    Block wire = interest.wireEncode();
-    for (auto&& p : m_faces) {
-      if (p.first == i) {
-        continue;
-      }
-      shared_ptr<DummyFace> face = p.second->face;
-      scheduler::schedule(m_delay, [wire, face] {
-        auto interest = make_shared<Interest>(wire);
-        face->receiveInterest(*interest);
-      });
-    }
-  }
-
-  void
-  transmitData(TopologyNode i, const Data& data)
-  {
-    if (!m_isUp) {
-      return;
-    }
-
-    // Data object cannot be shared between faces because
-    // Forwarder can set different IncomingFaceId.
-    Block wire = data.wireEncode();
-    for (auto&& p : m_faces) {
-      if (p.first == i) {
-        continue;
-      }
-      shared_ptr<DummyFace> face = p.second->face;
-      scheduler::schedule(m_delay, [wire, face] {
-        auto data = make_shared<Data>(wire);
-        face->receiveData(*data);
-      });
-    }
-  }
+  virtual void
+  scheduleReceive(TopologyTransportBase* recipient, const Block& packet) DECL_OVERRIDE;
 
 private:
   time::nanoseconds m_delay;
-  std::unordered_map<TopologyNode, unique_ptr<LinkFace>> m_faces;
+  std::unordered_map<TopologyNode, shared_ptr<face::LpFaceWrapper>> m_faces;
 };
 
 /** \brief represents a link to a local application
@@ -173,66 +188,32 @@
 class TopologyAppLink : public TopologyLinkBase
 {
 public:
+  explicit
+  TopologyAppLink(shared_ptr<face::LpFaceWrapper> face);
+
   /** \return face on forwarder side
    */
-  shared_ptr<DummyLocalFace>
+  Face&
   getForwarderFace()
   {
-    return m_face;
+    return *m_face;
   }
 
   /** \return face on application side
    */
-  shared_ptr<DummyClientFace>
+  ndn::Face&
   getClientFace()
   {
-    return m_client;
+    return *m_client;
   }
 
 private:
-  explicit
-  TopologyAppLink(shared_ptr<DummyLocalFace> face)
-    : m_face(face)
-    , m_client(ndn::util::makeDummyClientFace(getGlobalIoService(), {false, false}))
-  {
-    m_client->onSendInterest.connect([this] (const Interest& interest) {
-      if (!m_isUp) {
-        return;
-      }
-      auto interest2 = interest.shared_from_this();
-      getGlobalIoService().post([=] { m_face->receiveInterest(*interest2); });
-    });
-
-    m_client->onSendData.connect([this] (const Data& data) {
-      if (!m_isUp) {
-        return;
-      }
-      auto data2 = data.shared_from_this();
-      getGlobalIoService().post([=] { m_face->receiveData(*data2); });
-    });
-
-    m_face->onSendInterest.connect([this] (const Interest& interest) {
-      if (!m_isUp) {
-        return;
-      }
-      auto interest2 = interest.shared_from_this();
-      getGlobalIoService().post([=] { m_client->receive(*interest2); });
-    });
-
-    m_face->onSendData.connect([this] (const Data& data) {
-      if (!m_isUp) {
-        return;
-      }
-      auto data2 = data.shared_from_this();
-      getGlobalIoService().post([=] { m_client->receive(*data2); });
-    });
-  }
-
-  friend class TopologyTester;
+  virtual void
+  scheduleReceive(TopologyTransportBase* recipient, const Block& packet) DECL_OVERRIDE;
 
 private:
-  shared_ptr<DummyLocalFace> m_face;
-  shared_ptr<DummyClientFace> m_client;
+  shared_ptr<face::LpFaceWrapper> m_face;
+  shared_ptr<ndn::Face> m_client;
 };
 
 /** \brief builds a topology for forwarding tests
@@ -244,12 +225,7 @@
    *  \return index of new forwarder
    */
   TopologyNode
-  addForwarder()
-  {
-    size_t i = m_forwarders.size();
-    m_forwarders.push_back(make_unique<Forwarder>());
-    return i;
-  }
+  addForwarder(const std::string& label);
 
   /** \return forwarder instance \p i
    */
@@ -281,85 +257,42 @@
    *  this packet will be received by all other faces on this link after \p delay .
    */
   shared_ptr<TopologyLink>
-  addLink(const time::nanoseconds& delay, std::initializer_list<TopologyNode> forwarders)
-  {
-    auto link = shared_ptr<TopologyLink>(new TopologyLink(delay));
-    for (TopologyNode i : forwarders) {
-      Forwarder& forwarder = this->getForwarder(i);
-      shared_ptr<DummyFace> face = make_shared<DummyFace>();
-      forwarder.addFace(face);
-      link->addFace(i, face);
-    }
-    return link;
-  }
+  addLink(const std::string& label, const time::nanoseconds& delay,
+          std::initializer_list<TopologyNode> forwarders,
+          bool forceMultiAccessFace = false);
 
   /** \brief makes a link to local application
    */
   shared_ptr<TopologyAppLink>
-  addAppFace(TopologyNode i)
-  {
-    Forwarder& forwarder = this->getForwarder(i);
-    auto face = make_shared<DummyLocalFace>();
-    forwarder.addFace(face);
-
-    return shared_ptr<TopologyAppLink>(new TopologyAppLink(face));
-  }
+  addAppFace(const std::string& label, TopologyNode i);
 
   /** \brief makes a link to local application, and register a prefix
    */
   shared_ptr<TopologyAppLink>
-  addAppFace(TopologyNode i, const Name& prefix, uint64_t cost = 0)
-  {
-    shared_ptr<TopologyAppLink> al = this->addAppFace(i);
-    this->registerPrefix(i, al->getForwarderFace(), prefix, cost);
-    return al;
-  }
+  addAppFace(const std::string& label, TopologyNode i, const Name& prefix, uint64_t cost = 0);
 
-  /** \brief registers a prefix on a face
-   *  \tparam F either DummyFace or DummyLocalFace
+  /** \brief registers a prefix on a forwarder face
    */
-  template<typename F>
   void
-  registerPrefix(TopologyNode i, shared_ptr<F> face, const Name& prefix, uint64_t cost = 0)
-  {
-    Forwarder& forwarder = this->getForwarder(i);
-    Fib& fib = forwarder.getFib();
-    shared_ptr<fib::Entry> fibEntry = fib.insert(prefix).first;
-    fibEntry->addNextHop(face, cost);
-  }
+  registerPrefix(TopologyNode i, const Face& face, const Name& prefix, uint64_t cost = 0);
 
   /** \brief creates a producer application that answers every Interest with Data of same Name
    */
   void
-  addEchoProducer(DummyClientFace& face, const Name& prefix = "/")
-  {
-    face.setInterestFilter(prefix,
-        [&face] (const ndn::InterestFilter&, const Interest& interest) {
-          shared_ptr<Data> data = makeData(interest.getName());
-          face.put(*data);
-        });
-  }
+  addEchoProducer(ndn::Face& face, const Name& prefix = "/");
 
   /** \brief creates a consumer application that sends \p n Interests under \p prefix
    *         at \p interval fixed rate.
    */
   void
-  addIntervalConsumer(DummyClientFace& face, const Name& prefix,
-                      const time::nanoseconds& interval, size_t n)
-  {
-    Name name(prefix);
-    name.appendTimestamp();
-    shared_ptr<Interest> interest = makeInterest(name);
-    face.expressInterest(*interest, bind([]{}));
-
-    if (n > 1) {
-      scheduler::schedule(interval, bind(&TopologyTester::addIntervalConsumer, this,
-                                         ref(face), prefix, interval, n - 1));
-    }
-  }
+  addIntervalConsumer(ndn::Face& face, const Name& prefix,
+                      const time::nanoseconds& interval, size_t n);
 
 private:
   std::vector<unique_ptr<Forwarder>> m_forwarders;
+  std::vector<std::string> m_forwarderLabels;
+  std::vector<shared_ptr<TopologyLink>> m_links;
+  std::vector<shared_ptr<TopologyAppLink>> m_appLinks;
 };
 
 } // namespace tests
diff --git a/tests/daemon/table/pit.t.cpp b/tests/daemon/table/pit.t.cpp
index 7bd89fc..dd02bec 100644
--- a/tests/daemon/table/pit.t.cpp
+++ b/tests/daemon/table/pit.t.cpp
@@ -34,9 +34,12 @@
 
 using namespace nfd::tests;
 
-BOOST_FIXTURE_TEST_SUITE(TablePit, BaseFixture)
+BOOST_AUTO_TEST_SUITE(Table)
+BOOST_FIXTURE_TEST_SUITE(TestPit, BaseFixture)
 
-BOOST_AUTO_TEST_CASE(EntryInOutRecords)
+BOOST_AUTO_TEST_SUITE(PitEntry)
+
+BOOST_AUTO_TEST_CASE(InOutRecords)
 {
   shared_ptr<Face> face1 = make_shared<DummyFace>();
   shared_ptr<Face> face2 = make_shared<DummyFace>();
@@ -151,7 +154,7 @@
   BOOST_CHECK(entry.getOutRecord(*face2) == entry.getOutRecords().end());
 }
 
-BOOST_AUTO_TEST_CASE(EntryNonce)
+BOOST_AUTO_TEST_CASE(Nonce)
 {
   shared_ptr<Face> face1 = make_shared<DummyFace>();
   shared_ptr<Face> face2 = make_shared<DummyFace>();
@@ -210,7 +213,7 @@
   BOOST_CHECK_EQUAL(entry5.findNonce(19004, *face2), pit::DUPLICATE_NONCE_NONE);
 }
 
-BOOST_AUTO_TEST_CASE(EntryLifetime)
+BOOST_AUTO_TEST_CASE(Lifetime)
 {
   shared_ptr<Interest> interest = makeInterest("ndn:/7oIEurbgy6");
   // library uses -1 to indicate unset lifetime
@@ -226,7 +229,7 @@
   BOOST_CHECK_GT(outIt->getExpiry(), time::steady_clock::now());
 }
 
-BOOST_AUTO_TEST_CASE(EntryCanForwardTo)
+BOOST_AUTO_TEST_CASE(CanForwardTo)
 {
   shared_ptr<Interest> interest = makeInterest("ndn:/WDsuBLIMG");
   pit::Entry entry(*interest);
@@ -247,6 +250,37 @@
   BOOST_CHECK_EQUAL(entry.canForwardTo(*face2), true);
 }
 
+BOOST_AUTO_TEST_CASE(OutRecordNack)
+{
+  shared_ptr<Face> face1 = make_shared<DummyFace>();
+  pit::OutRecord outR(face1);
+  BOOST_CHECK(outR.getIncomingNack() == nullptr);
+
+  shared_ptr<Interest> interest1 = makeInterest("ndn:/uWiapGjYL");
+  interest1->setNonce(165);
+  outR.update(*interest1);
+  BOOST_CHECK(outR.getIncomingNack() == nullptr);
+
+  shared_ptr<Interest> interest2 = makeInterest("ndn:/uWiapGjYL");
+  interest2->setNonce(996);
+  lp::Nack nack2(*interest2);
+  nack2.setReason(lp::NackReason::CONGESTION);
+  BOOST_CHECK_EQUAL(outR.setIncomingNack(nack2), false);
+  BOOST_CHECK(outR.getIncomingNack() == nullptr);
+
+  lp::Nack nack1(*interest1);
+  nack1.setReason(lp::NackReason::DUPLICATE);
+  BOOST_CHECK_EQUAL(outR.setIncomingNack(nack1), true);
+  BOOST_REQUIRE(outR.getIncomingNack() != nullptr);
+  BOOST_CHECK_EQUAL(outR.getIncomingNack()->getReason(), lp::NackReason::DUPLICATE);
+
+  outR.clearIncomingNack();
+  BOOST_CHECK(outR.getIncomingNack() == nullptr);
+}
+
+BOOST_AUTO_TEST_SUITE_END() // PitEntry
+
+
 BOOST_AUTO_TEST_CASE(Insert)
 {
   Name name1("ndn:/5vzBNnMst");
@@ -368,18 +402,21 @@
   insertResult = pit.insert(*interest);
   BOOST_CHECK_EQUAL(insertResult.second, true);
   BOOST_CHECK_EQUAL(pit.size(), 1);
+  BOOST_CHECK(pit.find(*interest) != nullptr);
 
   insertResult = pit.insert(*interest);
   BOOST_CHECK_EQUAL(insertResult.second, false);
   BOOST_CHECK_EQUAL(pit.size(), 1);
+  BOOST_CHECK(pit.find(*interest) != nullptr);
 
   pit.erase(insertResult.first);
   BOOST_CHECK_EQUAL(pit.size(), 0);
+  BOOST_CHECK(pit.find(*interest) == nullptr);
 
   insertResult = pit.insert(*interest);
   BOOST_CHECK_EQUAL(insertResult.second, true);
   BOOST_CHECK_EQUAL(pit.size(), 1);
-
+  BOOST_CHECK(pit.find(*interest) != nullptr);
 }
 
 BOOST_AUTO_TEST_CASE(EraseNameTreeEntry)
@@ -496,6 +533,7 @@
 }
 
 BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END()
 
 } // namespace tests
 } // namespace pit
