face: introduce NullTransport and use it in several places

Refs: #4528
Change-Id: Icc7a77232bca1a700ce1319493c15a85d05d7488
diff --git a/core/common.hpp b/core/common.hpp
index c918724..efc9856 100644
--- a/core/common.hpp
+++ b/core/common.hpp
@@ -33,12 +33,14 @@
 #define PUBLIC_WITH_TESTS_ELSE_PROTECTED public
 #define PUBLIC_WITH_TESTS_ELSE_PRIVATE public
 #define PROTECTED_WITH_TESTS_ELSE_PRIVATE protected
+#define OVERRIDE_WITH_TESTS_ELSE_FINAL override
 #define FINAL_UNLESS_WITH_TESTS
 #else
 #define VIRTUAL_WITH_TESTS
 #define PUBLIC_WITH_TESTS_ELSE_PROTECTED protected
 #define PUBLIC_WITH_TESTS_ELSE_PRIVATE private
 #define PROTECTED_WITH_TESTS_ELSE_PRIVATE private
+#define OVERRIDE_WITH_TESTS_ELSE_FINAL final
 #define FINAL_UNLESS_WITH_TESTS final
 #endif
 
diff --git a/daemon/face/face.hpp b/daemon/face/face.hpp
index f99bece..440bb4d 100644
--- a/daemon/face/face.hpp
+++ b/daemon/face/face.hpp
@@ -64,11 +64,7 @@
  *  LinkService is the upper part, which translates between network-layer packets
  *  and TLV blocks, and may provide additional services such as fragmentation and reassembly.
  */
-class Face
-#ifndef WITH_TESTS
-final
-#endif
-  : public std::enable_shared_from_this<Face>, noncopyable
+class Face FINAL_UNLESS_WITH_TESTS : public std::enable_shared_from_this<Face>, noncopyable
 {
 public:
   Face(unique_ptr<LinkService> service, unique_ptr<Transport> transport);
diff --git a/daemon/face/generic-link-service.hpp b/daemon/face/generic-link-service.hpp
index cd124c0..9bbe1b8 100644
--- a/daemon/face/generic-link-service.hpp
+++ b/daemon/face/generic-link-service.hpp
@@ -89,8 +89,8 @@
 /** \brief GenericLinkService is a LinkService that implements the NDNLPv2 protocol
  *  \sa https://redmine.named-data.net/projects/nfd/wiki/NDNLPv2
  */
-class GenericLinkService : public LinkService
-                         , protected virtual GenericLinkServiceCounters
+class GenericLinkService FINAL_UNLESS_WITH_TESTS : public LinkService
+                                                 , protected virtual GenericLinkServiceCounters
 {
 public:
   /** \brief Options that control the behavior of GenericLinkService
@@ -167,7 +167,7 @@
   setOptions(const Options& options);
 
   const Counters&
-  getCounters() const override;
+  getCounters() const OVERRIDE_WITH_TESTS_ELSE_FINAL;
 
 PROTECTED_WITH_TESTS_ELSE_PRIVATE: // send path
   /** \brief request an IDLE packet to transmit pending service fields
@@ -184,17 +184,17 @@
   /** \brief send Interest
    */
   void
-  doSendInterest(const Interest& interest) override;
+  doSendInterest(const Interest& interest) OVERRIDE_WITH_TESTS_ELSE_FINAL;
 
   /** \brief send Data
    */
   void
-  doSendData(const Data& data) override;
+  doSendData(const Data& data) OVERRIDE_WITH_TESTS_ELSE_FINAL;
 
   /** \brief send Nack
    */
   void
-  doSendNack(const ndn::lp::Nack& nack) override;
+  doSendNack(const ndn::lp::Nack& nack) OVERRIDE_WITH_TESTS_ELSE_FINAL;
 
 private: // send path
   /** \brief encode link protocol fields from tags onto an outgoing LpPacket
@@ -232,7 +232,7 @@
   /** \brief receive Packet from Transport
    */
   void
-  doReceivePacket(Transport::Packet&& packet) override;
+  doReceivePacket(Transport::Packet&& packet) OVERRIDE_WITH_TESTS_ELSE_FINAL;
 
   /** \brief decode incoming network-layer packet
    *  \param netPkt reassembled network-layer packet
diff --git a/daemon/face/null-face.cpp b/daemon/face/null-face.cpp
index 2ce5c98..77178c6 100644
--- a/daemon/face/null-face.cpp
+++ b/daemon/face/null-face.cpp
@@ -25,7 +25,7 @@
 
 #include "null-face.hpp"
 #include "null-link-service.hpp"
-#include "internal-transport.hpp"
+#include "null-transport.hpp"
 
 namespace nfd {
 namespace face {
@@ -36,7 +36,7 @@
   // FIB could restrict creating a nexthop record toward a non-local face in /localhost namespace.
   // Therefore, NullFace has scope=local to enable creating a "blackhole" FIB entry under /localhost.
   return make_shared<Face>(make_unique<NullLinkService>(),
-                           make_unique<InternalForwarderTransport>(uri, uri, ndn::nfd::FACE_SCOPE_LOCAL));
+                           make_unique<NullTransport>(uri, uri, ndn::nfd::FACE_SCOPE_LOCAL));
 }
 
 } // namespace face
diff --git a/daemon/face/null-transport.cpp b/daemon/face/null-transport.cpp
new file mode 100644
index 0000000..912bf25
--- /dev/null
+++ b/daemon/face/null-transport.cpp
@@ -0,0 +1,47 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2014-2019,  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 "null-transport.hpp"
+
+namespace nfd {
+namespace face {
+
+NFD_LOG_INIT(NullTransport);
+
+NullTransport::NullTransport(const FaceUri& localUri, const FaceUri& remoteUri,
+                             ndn::nfd::FaceScope scope, ndn::nfd::FacePersistency persistency)
+{
+  this->setLocalUri(localUri);
+  this->setRemoteUri(remoteUri);
+  this->setScope(scope);
+  this->setPersistency(persistency);
+  this->setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT);
+  this->setMtu(MTU_UNLIMITED);
+
+  NFD_LOG_FACE_DEBUG("Creating transport");
+}
+
+} // namespace face
+} // namespace nfd
diff --git a/daemon/face/null-transport.hpp b/daemon/face/null-transport.hpp
new file mode 100644
index 0000000..9f8e54e
--- /dev/null
+++ b/daemon/face/null-transport.hpp
@@ -0,0 +1,62 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2014-2019,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NFD_DAEMON_FACE_NULL_TRANSPORT_HPP
+#define NFD_DAEMON_FACE_NULL_TRANSPORT_HPP
+
+#include "transport.hpp"
+
+namespace nfd {
+namespace face {
+
+/** \brief A Transport that drops every packet.
+ */
+class NullTransport FINAL_UNLESS_WITH_TESTS : public Transport
+{
+public:
+  explicit
+  NullTransport(const FaceUri& localUri = FaceUri("null://"),
+                const FaceUri& remoteUri = FaceUri("null://"),
+                ndn::nfd::FaceScope scope = ndn::nfd::FACE_SCOPE_NON_LOCAL,
+                ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERMANENT);
+
+protected:
+  void
+  doClose() OVERRIDE_WITH_TESTS_ELSE_FINAL
+  {
+    setState(TransportState::CLOSED);
+  }
+
+private:
+  void
+  doSend(Packet&&) OVERRIDE_WITH_TESTS_ELSE_FINAL
+  {
+  }
+};
+
+} // namespace face
+} // namespace nfd
+
+#endif // NFD_DAEMON_FACE_NULL_TRANSPORT_HPP
diff --git a/docs/doxygen.conf.in b/docs/doxygen.conf.in
index 7928d8c..5ca87f3 100644
--- a/docs/doxygen.conf.in
+++ b/docs/doxygen.conf.in
@@ -2061,6 +2061,7 @@
                          PUBLIC_WITH_TESTS_ELSE_PROTECTED=protected \
                          PUBLIC_WITH_TESTS_ELSE_PRIVATE=private \
                          PROTECTED_WITH_TESTS_ELSE_PRIVATE=private \
+                         OVERRIDE_WITH_TESTS_ELSE_FINAL=final \
                          FINAL_UNLESS_WITH_TESTS=final
 
 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
diff --git a/tests/daemon/face/dummy-face.cpp b/tests/daemon/face/dummy-face.cpp
index 5c9895b..367afed 100644
--- a/tests/daemon/face/dummy-face.cpp
+++ b/tests/daemon/face/dummy-face.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -54,29 +54,29 @@
   signal::Signal<LinkService, uint32_t> afterSend;
 
 private:
-  virtual void
-  doSendInterest(const Interest& interest) override
+  void
+  doSendInterest(const Interest& interest) final
   {
     this->sentInterests.push_back(interest);
     this->afterSend(tlv::Interest);
   }
 
-  virtual void
-  doSendData(const Data& data) override
+  void
+  doSendData(const Data& data) final
   {
     this->sentData.push_back(data);
     this->afterSend(tlv::Data);
   }
 
-  virtual void
-  doSendNack(const lp::Nack& nack) override
+  void
+  doSendNack(const lp::Nack& nack) final
   {
     this->sentNacks.push_back(nack);
     this->afterSend(lp::tlv::Nack);
   }
 
-  virtual void
-  doReceivePacket(Transport::Packet&& packet) override
+  void
+  doReceivePacket(Transport::Packet&&) final
   {
     BOOST_ASSERT(false);
   }
@@ -102,7 +102,7 @@
 void
 DummyFace::setState(FaceState state)
 {
-  this->getTransportInternal()->setState(state);
+  static_cast<DummyTransport*>(this->getTransport())->setState(state);
 }
 
 void
@@ -129,12 +129,6 @@
   return static_cast<LinkService*>(this->getLinkService());
 }
 
-DummyTransport*
-DummyFace::getTransportInternal()
-{
-  return static_cast<DummyTransport*>(this->getTransport());
-}
-
 } // namespace tests
 } // namespace face
 } // namespace nfd
diff --git a/tests/daemon/face/dummy-face.hpp b/tests/daemon/face/dummy-face.hpp
index e4c68b3..93bcd48 100644
--- a/tests/daemon/face/dummy-face.hpp
+++ b/tests/daemon/face/dummy-face.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -32,8 +32,6 @@
 namespace face {
 namespace tests {
 
-class DummyTransport;
-
 /** \brief a Face for unit testing
  *
  *  The DummyFace has no underlying transport, but allows observing outgoing packets
@@ -87,9 +85,6 @@
   LinkService*
   getLinkServiceInternal();
 
-  DummyTransport*
-  getTransportInternal();
-
 public:
   std::vector<Interest>& sentInterests;
   std::vector<Data>& sentData;
@@ -102,6 +97,7 @@
 namespace tests {
 using nfd::face::tests::DummyFace;
 } // namespace tests
+
 } // namespace nfd
 
 #endif // NFD_TESTS_DAEMON_FACE_DUMMY_FACE_HPP
diff --git a/tests/daemon/face/dummy-transport.hpp b/tests/daemon/face/dummy-transport.hpp
index 08a7141..1594df8 100644
--- a/tests/daemon/face/dummy-transport.hpp
+++ b/tests/daemon/face/dummy-transport.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -28,47 +28,39 @@
 
 #include "core/common.hpp"
 
-#include "face/transport.hpp"
+#include "face/null-transport.hpp"
 
 namespace nfd {
 namespace face {
 namespace tests {
 
-/** \brief dummy Transport used in unit tests
+/** \brief Dummy Transport type used in unit tests.
+ *
+ *  All packets sent through this transport are stored in `sentPackets`.
+ *  Reception of a packet can be simulated by invoking `receivePacket()`.
+ *  All persistency changes are recorded in `persistencyHistory`.
  */
-class DummyTransport : public Transport
+template<bool CAN_CHANGE_PERSISTENCY>
+class DummyTransportBase : public NullTransport
 {
 public:
-  DummyTransport(const std::string& localUri = "dummy://",
-                 const std::string& remoteUri = "dummy://",
-                 ndn::nfd::FaceScope scope = ndn::nfd::FACE_SCOPE_NON_LOCAL,
-                 ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-                 ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_POINT_TO_POINT,
-                 ssize_t mtu = MTU_UNLIMITED,
-                 ssize_t sendQueueCapacity = QUEUE_UNSUPPORTED)
-    : isClosed(false)
-    , m_sendQueueLength(0)
+  explicit
+  DummyTransportBase(const std::string& localUri = "dummy://",
+                     const std::string& remoteUri = "dummy://",
+                     ndn::nfd::FaceScope scope = ndn::nfd::FACE_SCOPE_NON_LOCAL,
+                     ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+                     ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_POINT_TO_POINT,
+                     ssize_t mtu = MTU_UNLIMITED,
+                     ssize_t sendQueueCapacity = QUEUE_UNSUPPORTED)
+    : NullTransport(FaceUri(localUri), FaceUri(remoteUri), scope, persistency)
   {
-    this->setLocalUri(FaceUri(localUri));
-    this->setRemoteUri(FaceUri(remoteUri));
-    this->setScope(scope);
-    this->setPersistency(persistency);
     this->setLinkType(linkType);
     this->setMtu(mtu);
     this->setSendQueueCapacity(sendQueueCapacity);
   }
 
-  void
-  setMtu(ssize_t mtu)
-  {
-    this->Transport::setMtu(mtu);
-  }
-
-  void
-  setState(FaceState state)
-  {
-    this->Transport::setState(state);
-  }
+  using NullTransport::setMtu;
+  using NullTransport::setState;
 
   ssize_t
   getSendQueueLength() override
@@ -83,46 +75,41 @@
   }
 
   void
-  receivePacket(Packet&& packet)
-  {
-    this->receive(std::move(packet));
-  }
-
-  void
   receivePacket(Block block)
   {
-    this->receive(Packet(std::move(block)));
+    receive(Packet(std::move(block)));
   }
 
 protected:
   bool
-  canChangePersistencyToImpl(ndn::nfd::FacePersistency newPersistency) const override
+  canChangePersistencyToImpl(ndn::nfd::FacePersistency) const override
   {
-    return true;
+    return CAN_CHANGE_PERSISTENCY;
+  }
+
+  void
+  afterChangePersistency(ndn::nfd::FacePersistency old) override
+  {
+    persistencyHistory.push_back(old);
   }
 
 private:
   void
-  doClose() override
-  {
-    isClosed = true;
-    this->setState(TransportState::CLOSED);
-  }
-
-  void
   doSend(Packet&& packet) override
   {
     sentPackets.push_back(std::move(packet));
   }
 
 public:
-  bool isClosed;
+  std::vector<ndn::nfd::FacePersistency> persistencyHistory;
   std::vector<Packet> sentPackets;
 
 private:
-  ssize_t m_sendQueueLength;
+  ssize_t m_sendQueueLength = 0;
 };
 
+using DummyTransport = DummyTransportBase<true>;
+
 } // namespace tests
 } // namespace face
 } // namespace nfd
diff --git a/tests/daemon/face/generic-link-service.t.cpp b/tests/daemon/face/generic-link-service.t.cpp
index cf51e54..64682c0 100644
--- a/tests/daemon/face/generic-link-service.t.cpp
+++ b/tests/daemon/face/generic-link-service.t.cpp
@@ -1362,7 +1362,7 @@
 
   Block packet = ndn::encoding::makeEmptyBlock(tlv::Name);
 
-  BOOST_CHECK_NO_THROW(transport->receivePacket(packet));
+  BOOST_CHECK_NO_THROW(transport->receivePacket(std::move(packet)));
 
   BOOST_CHECK_EQUAL(service->getCounters().nInLpInvalid, 1);
   BOOST_CHECK_EQUAL(receivedInterests.size(), 0);
@@ -1380,7 +1380,7 @@
   Block packet = ndn::encoding::makeStringBlock(lp::tlv::LpPacket, "x");
   BOOST_CHECK_THROW(packet.parse(), tlv::Error);
 
-  BOOST_CHECK_NO_THROW(transport->receivePacket(packet));
+  BOOST_CHECK_NO_THROW(transport->receivePacket(std::move(packet)));
 
   BOOST_CHECK_EQUAL(service->getCounters().nInLpInvalid, 1);
   BOOST_CHECK_EQUAL(receivedInterests.size(), 0);
diff --git a/tests/daemon/face/null-face.t.cpp b/tests/daemon/face/null-face.t.cpp
index 6d34770..d7f7d29 100644
--- a/tests/daemon/face/null-face.t.cpp
+++ b/tests/daemon/face/null-face.t.cpp
@@ -24,6 +24,7 @@
  */
 
 #include "face/null-face.hpp"
+#include "face/null-transport.hpp"
 
 #include "tests/daemon/global-io-fixture.hpp"
 #include "transport-test-common.hpp"
@@ -37,29 +38,65 @@
 BOOST_AUTO_TEST_SUITE(Face)
 BOOST_FIXTURE_TEST_SUITE(TestNullFace, GlobalIoFixture)
 
-using nfd::Face;
-
 BOOST_AUTO_TEST_CASE(StaticProperties)
 {
-  shared_ptr<Face> face = makeNullFace(FaceUri("testnull://hhppt12sy"));
-  checkStaticPropertiesInitialized(*face->getTransport());
+  FaceUri uri("testnull://hhppt12sy");
+  auto face = makeNullFace(uri);
+  auto transport = face->getTransport();
 
-  BOOST_CHECK_EQUAL(face->getLocalUri(), FaceUri("testnull://hhppt12sy"));
-  BOOST_CHECK_EQUAL(face->getRemoteUri(), FaceUri("testnull://hhppt12sy"));
-  BOOST_CHECK_EQUAL(face->getScope(), ndn::nfd::FACE_SCOPE_LOCAL);
+  checkStaticPropertiesInitialized(*transport);
+
+  BOOST_CHECK_EQUAL(transport->getLocalUri(), uri);
+  BOOST_CHECK_EQUAL(transport->getRemoteUri(), uri);
+  BOOST_CHECK_EQUAL(transport->getScope(), ndn::nfd::FACE_SCOPE_LOCAL);
+  BOOST_CHECK_EQUAL(transport->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERMANENT);
+  BOOST_CHECK_EQUAL(transport->getLinkType(), ndn::nfd::LINK_TYPE_POINT_TO_POINT);
+  BOOST_CHECK_EQUAL(transport->getMtu(), MTU_UNLIMITED);
+}
+
+BOOST_AUTO_TEST_CASE(ExpirationTime)
+{
+  auto transport = make_unique<NullTransport>();
+
+  BOOST_CHECK_EQUAL(transport->getExpirationTime(), time::steady_clock::TimePoint::max());
+}
+
+BOOST_AUTO_TEST_CASE(SendQueue)
+{
+  auto transport = make_unique<NullTransport>();
+
+  BOOST_CHECK_EQUAL(transport->getSendQueueCapacity(), QUEUE_UNSUPPORTED);
+  BOOST_CHECK_EQUAL(transport->getSendQueueLength(), QUEUE_UNSUPPORTED);
 }
 
 BOOST_AUTO_TEST_CASE(Send)
 {
-  shared_ptr<Face> face = makeNullFace();
+  auto face = makeNullFace();
+  BOOST_CHECK_EQUAL(face->getState(), FaceState::UP);
 
-  shared_ptr<Interest> interest = makeInterest("/A");
-  BOOST_CHECK_NO_THROW(face->sendInterest(*interest));
+  face->sendInterest(*makeInterest("/A"));
+  BOOST_CHECK_EQUAL(face->getState(), FaceState::UP);
 
-  shared_ptr<Data> data = makeData("/B");
-  BOOST_CHECK_NO_THROW(face->sendData(*data));
+  face->sendData(*makeData("/B"));
+  BOOST_CHECK_EQUAL(face->getState(), FaceState::UP);
+}
 
-  BOOST_CHECK_NO_THROW(face->close());
+BOOST_AUTO_TEST_CASE(PersistencyChange)
+{
+  auto transport = make_unique<NullTransport>();
+
+  BOOST_CHECK_EQUAL(transport->canChangePersistencyTo(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND), false);
+  BOOST_CHECK_EQUAL(transport->canChangePersistencyTo(ndn::nfd::FACE_PERSISTENCY_PERSISTENT), false);
+  BOOST_CHECK_EQUAL(transport->canChangePersistencyTo(ndn::nfd::FACE_PERSISTENCY_PERMANENT), true);
+}
+
+BOOST_AUTO_TEST_CASE(Close)
+{
+  auto transport = make_unique<NullTransport>();
+  BOOST_CHECK_EQUAL(transport->getState(), TransportState::UP);
+
+  transport->close();
+  BOOST_CHECK_EQUAL(transport->getState(), TransportState::CLOSED);
 }
 
 BOOST_AUTO_TEST_SUITE_END() // TestNullFace
diff --git a/tests/daemon/face/transport.t.cpp b/tests/daemon/face/transport.t.cpp
index 747622e..fbe3ee5 100644
--- a/tests/daemon/face/transport.t.cpp
+++ b/tests/daemon/face/transport.t.cpp
@@ -26,10 +26,10 @@
 #include "face/transport.hpp"
 #include "face/face.hpp"
 
+#include "tests/test-common.hpp"
 #include "tests/daemon/global-io-fixture.hpp"
 #include "dummy-receive-link-service.hpp"
 #include "dummy-transport.hpp"
-#include "transport-test-common.hpp"
 
 #include <boost/mpl/fold.hpp>
 #include <boost/mpl/int.hpp>
@@ -50,37 +50,10 @@
 BOOST_AUTO_TEST_SUITE(Face)
 BOOST_AUTO_TEST_SUITE(TestTransport)
 
-BOOST_AUTO_TEST_CASE(DummyTransportStaticProperties)
-{
-  auto transport = make_unique<DummyTransport>();
-  checkStaticPropertiesInitialized(*transport);
-}
-
-class PersistencyTestTransport : public DummyTransport
-{
-public:
-  PersistencyTestTransport()
-    : DummyTransport("dummy://", "dummy://",
-                     ndn::nfd::FACE_SCOPE_NON_LOCAL,
-                     ndn::nfd::FACE_PERSISTENCY_ON_DEMAND)
-  {
-  }
-
-protected:
-  void
-  afterChangePersistency(ndn::nfd::FacePersistency oldPersistency) final
-  {
-    persistencyHistory.push_back(oldPersistency);
-  }
-
-public:
-  std::vector<ndn::nfd::FacePersistency> persistencyHistory;
-};
-
 BOOST_AUTO_TEST_CASE(PersistencyChange)
 {
-  auto transport = make_unique<PersistencyTestTransport>();
-  BOOST_CHECK_EQUAL(transport->getPersistency(), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
+  auto transport = make_unique<DummyTransport>();
+  BOOST_CHECK_EQUAL(transport->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
   BOOST_CHECK_EQUAL(transport->persistencyHistory.size(), 0);
 
   BOOST_CHECK_EQUAL(transport->canChangePersistencyTo(ndn::nfd::FACE_PERSISTENCY_NONE), false);
@@ -88,13 +61,13 @@
   BOOST_REQUIRE_EQUAL(transport->canChangePersistencyTo(ndn::nfd::FACE_PERSISTENCY_PERMANENT), true);
 
   transport->setPersistency(transport->getPersistency());
-  BOOST_CHECK_EQUAL(transport->getPersistency(), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
+  BOOST_CHECK_EQUAL(transport->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
   BOOST_CHECK_EQUAL(transport->persistencyHistory.size(), 0);
 
   transport->setPersistency(ndn::nfd::FACE_PERSISTENCY_PERMANENT);
   BOOST_CHECK_EQUAL(transport->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERMANENT);
   BOOST_REQUIRE_EQUAL(transport->persistencyHistory.size(), 1);
-  BOOST_CHECK_EQUAL(transport->persistencyHistory.back(), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
+  BOOST_CHECK_EQUAL(transport->persistencyHistory.back(), ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
 }
 
 /** \brief a macro to declare a TransportState as a integral constant
@@ -205,13 +178,6 @@
   }
 }
 
-BOOST_AUTO_TEST_CASE(NoExpirationTime)
-{
-  auto transport = make_unique<DummyTransport>();
-
-  BOOST_CHECK_EQUAL(transport->getExpirationTime(), time::steady_clock::TimePoint::max());
-}
-
 class DummyTransportFixture : public GlobalIoFixture
 {
 protected:
@@ -225,9 +191,9 @@
   }
 
   void
-  initialize(unique_ptr<DummyTransport> transport = make_unique<DummyTransport>())
+  initialize(unique_ptr<DummyTransport> t = make_unique<DummyTransport>())
   {
-    this->face = make_unique<nfd::Face>(make_unique<DummyReceiveLinkService>(), std::move(transport));
+    this->face = make_unique<nfd::Face>(make_unique<DummyReceiveLinkService>(), std::move(t));
     this->transport = static_cast<DummyTransport*>(face->getTransport());
     this->sentPackets = &this->transport->sentPackets;
     this->receivedPackets = &static_cast<DummyReceiveLinkService*>(face->getLinkService())->receivedPackets;
diff --git a/tests/daemon/mgmt/face-manager-update-face.t.cpp b/tests/daemon/mgmt/face-manager-update-face.t.cpp
index 4cd6fb6..a20394f 100644
--- a/tests/daemon/mgmt/face-manager-update-face.t.cpp
+++ b/tests/daemon/mgmt/face-manager-update-face.t.cpp
@@ -25,7 +25,9 @@
 
 #include "mgmt/face-manager.hpp"
 #include "face/generic-link-service.hpp"
+
 #include "face-manager-command-fixture.hpp"
+#include "tests/daemon/face/dummy-transport.hpp"
 
 #include <ndn-cxx/lp/tags.hpp>
 
@@ -201,37 +203,10 @@
   });
 }
 
-template<bool CAN_CHANGE_PERSISTENCY>
-class UpdatePersistencyDummyTransport : public face::Transport
-{
-public:
-  UpdatePersistencyDummyTransport()
-  {
-    this->setPersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
-  }
-
-protected:
-  bool
-  canChangePersistencyToImpl(ndn::nfd::FacePersistency) const final
-  {
-    return CAN_CHANGE_PERSISTENCY;
-  }
-
-  void
-  doClose() final
-  {
-  }
-
-private:
-  void
-  doSend(face::Transport::Packet&&) final
-  {
-  }
-};
-
+using nfd::face::tests::DummyTransportBase;
 using UpdatePersistencyTests = mpl::vector<
-  mpl::pair<UpdatePersistencyDummyTransport<true>, CommandSuccess>,
-  mpl::pair<UpdatePersistencyDummyTransport<false>, CommandFailure<409>>
+  mpl::pair<DummyTransportBase<true>, CommandSuccess>,
+  mpl::pair<DummyTransportBase<false>, CommandFailure<409>>
 >;
 
 BOOST_FIXTURE_TEST_CASE_TEMPLATE(UpdatePersistency, T, UpdatePersistencyTests, FaceManagerUpdateFixture)