diff --git a/tests/unit-tests/face.t.cpp b/tests/unit-tests/face.t.cpp
index 43164a6..928a050 100644
--- a/tests/unit-tests/face.t.cpp
+++ b/tests/unit-tests/face.t.cpp
@@ -33,19 +33,18 @@
 namespace tests {
 
 using ndn::util::DummyClientFace;
-using ndn::util::makeDummyClientFace;
 
 class FaceFixture : public UnitTestTimeFixture
 {
 public:
   explicit
   FaceFixture(bool enableRegistrationReply = true)
-    : face(makeDummyClientFace(io, { true, enableRegistrationReply }))
+    : face(io, { true, enableRegistrationReply })
   {
   }
 
 public:
-  shared_ptr<DummyClientFace> face;
+  DummyClientFace face;
 };
 
 class FacesNoRegistrationReplyFixture : public FaceFixture
@@ -62,37 +61,37 @@
 BOOST_AUTO_TEST_CASE(ExpressInterestData)
 {
   size_t nData = 0;
-  face->expressInterest(Interest("/Hello/World", time::milliseconds(50)),
-                        [&] (const Interest& i, const Data& d) {
-                          BOOST_CHECK(i.getName().isPrefixOf(d.getName()));
-                          BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
-                          ++nData;
-                        },
-                        bind([] {
-                          BOOST_FAIL("Unexpected Nack");
-                        }),
-                        bind([] {
-                          BOOST_FAIL("Unexpected timeout");
-                        }));
+  face.expressInterest(Interest("/Hello/World", time::milliseconds(50)),
+                       [&] (const Interest& i, const Data& d) {
+                         BOOST_CHECK(i.getName().isPrefixOf(d.getName()));
+                         BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
+                         ++nData;
+                       },
+                       bind([] {
+                         BOOST_FAIL("Unexpected Nack");
+                       }),
+                       bind([] {
+                         BOOST_FAIL("Unexpected timeout");
+                       }));
 
   advanceClocks(time::milliseconds(1), 40);
 
-  face->receive(*util::makeData("/Bye/World/a"));
-  face->receive(*util::makeData("/Hello/World/a"));
+  face.receive(*util::makeData("/Bye/World/a"));
+  face.receive(*util::makeData("/Hello/World/a"));
 
   advanceClocks(time::milliseconds(1), 100);
 
   BOOST_CHECK_EQUAL(nData, 1);
-  BOOST_CHECK_EQUAL(face->sentInterests.size(), 1);
-  BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
+  BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face.sentData.size(), 0);
 
   size_t nTimeouts = 0;
-  face->expressInterest(Interest("/Hello/World/a/2", time::milliseconds(50)),
-                        bind([]{}),
-                        bind([]{}),
-                        bind([&nTimeouts] {
-                            ++nTimeouts;
-                        }));
+  face.expressInterest(Interest("/Hello/World/a/2", time::milliseconds(50)),
+                       bind([]{}),
+                       bind([]{}),
+                       bind([&nTimeouts] {
+                           ++nTimeouts;
+                       }));
   advanceClocks(time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(nTimeouts, 1);
 }
@@ -101,49 +100,49 @@
 BOOST_AUTO_TEST_CASE(DeprecatedExpressInterestData)
 {
   size_t nData = 0;
-  face->expressInterest(Interest("/Hello/World", time::milliseconds(50)),
-                        [&] (const Interest& i, const Data& d) {
-                          BOOST_CHECK(i.getName().isPrefixOf(d.getName()));
-                          ++nData;
-                        },
-                        bind([] {
-                            BOOST_FAIL("Unexpected timeout");
-                          }));
+  face.expressInterest(Interest("/Hello/World", time::milliseconds(50)),
+                       [&] (const Interest& i, const Data& d) {
+                         BOOST_CHECK(i.getName().isPrefixOf(d.getName()));
+                         ++nData;
+                       },
+                       bind([] {
+                           BOOST_FAIL("Unexpected timeout");
+                         }));
 
   advanceClocks(time::milliseconds(1), 40);
 
-  face->receive(*util::makeData("/Bye/World/a"));
-  face->receive(*util::makeData("/Hello/World/a"));
+  face.receive(*util::makeData("/Bye/World/a"));
+  face.receive(*util::makeData("/Hello/World/a"));
 
   advanceClocks(time::milliseconds(1), 100);
 
   BOOST_CHECK_EQUAL(nData, 1);
-  BOOST_CHECK_EQUAL(face->sentInterests.size(), 1);
-  BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
+  BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face.sentData.size(), 0);
 
-  face->expressInterest(Interest("/Hello/World/a", time::milliseconds(50)),
-                        [&] (const Interest& i, const Data& d) {
-                          BOOST_CHECK(i.getName().isPrefixOf(d.getName()));
-                          ++nData;
-                        },
-                        bind([] {
-                            BOOST_FAIL("Unexpected timeout");
-                          }));
+  face.expressInterest(Interest("/Hello/World/a", time::milliseconds(50)),
+                       [&] (const Interest& i, const Data& d) {
+                         BOOST_CHECK(i.getName().isPrefixOf(d.getName()));
+                         ++nData;
+                       },
+                       bind([] {
+                           BOOST_FAIL("Unexpected timeout");
+                         }));
   advanceClocks(time::milliseconds(1), 40);
-  face->receive(*util::makeData("/Hello/World/a/1/xxxxx"));
+  face.receive(*util::makeData("/Hello/World/a/1/xxxxx"));
 
   advanceClocks(time::milliseconds(1), 100);
 
   BOOST_CHECK_EQUAL(nData, 2);
-  BOOST_CHECK_EQUAL(face->sentInterests.size(), 2);
-  BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
+  BOOST_CHECK_EQUAL(face.sentInterests.size(), 2);
+  BOOST_CHECK_EQUAL(face.sentData.size(), 0);
 
   size_t nTimeouts = 0;
-  face->expressInterest(Interest("/Hello/World/a/2", time::milliseconds(50)),
-                        bind([]{}),
-                        bind([&nTimeouts] {
-                            ++nTimeouts;
-                          }));
+  face.expressInterest(Interest("/Hello/World/a/2", time::milliseconds(50)),
+                       bind([]{}),
+                       bind([&nTimeouts] {
+                           ++nTimeouts;
+                         }));
   advanceClocks(time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(nTimeouts, 1);
 }
@@ -151,43 +150,43 @@
 BOOST_AUTO_TEST_CASE(ExpressInterestTimeout)
 {
   size_t nTimeouts = 0;
-  face->expressInterest(Interest("/Hello/World", time::milliseconds(50)),
-                        bind([] {
-                          BOOST_FAIL("Unexpected ata");
-                        }),
-                        bind([] {
-                          BOOST_FAIL("Unexpected Nack");
-                        }),
-                        [&nTimeouts] (const Interest& i) {
-                          BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
-                          ++nTimeouts;
-                        });
+  face.expressInterest(Interest("/Hello/World", time::milliseconds(50)),
+                       bind([] {
+                         BOOST_FAIL("Unexpected ata");
+                       }),
+                       bind([] {
+                         BOOST_FAIL("Unexpected Nack");
+                       }),
+                       [&nTimeouts] (const Interest& i) {
+                         BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
+                         ++nTimeouts;
+                       });
 
   advanceClocks(time::milliseconds(10), 100);
 
   BOOST_CHECK_EQUAL(nTimeouts, 1);
-  BOOST_CHECK_EQUAL(face->sentInterests.size(), 1);
-  BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
-  BOOST_CHECK_EQUAL(face->sentNacks.size(), 0);
+  BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face.sentData.size(), 0);
+  BOOST_CHECK_EQUAL(face.sentNacks.size(), 0);
 }
 
 // test case for deprecated expressInterest implementation
 BOOST_AUTO_TEST_CASE(DeprecatedExpressInterestTimeout)
 {
   size_t nTimeouts = 0;
-  face->expressInterest(Interest("/Hello/World", time::milliseconds(50)),
-                        bind([] {
-                            BOOST_FAIL("Unexpected data");
-                          }),
-                        bind([&nTimeouts] {
-                            ++nTimeouts;
-                          }));
+  face.expressInterest(Interest("/Hello/World", time::milliseconds(50)),
+                       bind([] {
+                           BOOST_FAIL("Unexpected data");
+                         }),
+                       bind([&nTimeouts] {
+                           ++nTimeouts;
+                         }));
 
   advanceClocks(time::milliseconds(10), 100);
 
   BOOST_CHECK_EQUAL(nTimeouts, 1);
-  BOOST_CHECK_EQUAL(face->sentInterests.size(), 1);
-  BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
+  BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face.sentData.size(), 0);
 }
 
 BOOST_AUTO_TEST_CASE(ExpressInterestNack)
@@ -196,75 +195,75 @@
 
   Interest interest("/Hello/World", time::milliseconds(50));
 
-  face->expressInterest(interest,
-                        bind([] {
-                          BOOST_FAIL("Unexpected Data");
-                        }),
-                        [&] (const Interest& i, const lp::Nack& n) {
-                          BOOST_CHECK(i.getName().isPrefixOf(n.getInterest().getName()));
-                          BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
-                          BOOST_CHECK_EQUAL(n.getReason(), lp::NackReason::DUPLICATE);
-                          ++nNacks;
-                        },
-                        bind([] {
-                          BOOST_FAIL("Unexpected timeout");
-                        }));
+  face.expressInterest(interest,
+                       bind([] {
+                         BOOST_FAIL("Unexpected Data");
+                       }),
+                       [&] (const Interest& i, const lp::Nack& n) {
+                         BOOST_CHECK(i.getName().isPrefixOf(n.getInterest().getName()));
+                         BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
+                         BOOST_CHECK_EQUAL(n.getReason(), lp::NackReason::DUPLICATE);
+                         ++nNacks;
+                       },
+                       bind([] {
+                         BOOST_FAIL("Unexpected timeout");
+                       }));
 
   advanceClocks(time::milliseconds(1), 40);
 
-  lp::Nack nack(face->sentInterests[0]);
+  lp::Nack nack(face.sentInterests[0]);
   nack.setReason(lp::NackReason::DUPLICATE);
 
-  BOOST_CHECK_EQUAL(face->sentNacks.size(), 0);
+  BOOST_CHECK_EQUAL(face.sentNacks.size(), 0);
 
-  face->receive(nack);
+  face.receive(nack);
 
   advanceClocks(time::milliseconds(1), 100);
 
   BOOST_CHECK_EQUAL(nNacks, 1);
-  BOOST_CHECK_EQUAL(face->sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
 }
 
 BOOST_AUTO_TEST_CASE(RemovePendingInterest)
 {
   const PendingInterestId* interestId =
-    face->expressInterest(Interest("/Hello/World", time::milliseconds(50)),
-                          bind([] {
-                              BOOST_FAIL("Unexpected data");
-                            }),
-                          bind([] {
-                              BOOST_FAIL("Unexpected timeout");
-                            }));
+    face.expressInterest(Interest("/Hello/World", time::milliseconds(50)),
+                         bind([] {
+                             BOOST_FAIL("Unexpected data");
+                           }),
+                         bind([] {
+                             BOOST_FAIL("Unexpected timeout");
+                           }));
   advanceClocks(time::milliseconds(10));
 
-  face->removePendingInterest(interestId);
+  face.removePendingInterest(interestId);
   advanceClocks(time::milliseconds(10));
 
-  face->receive(*util::makeData("/Hello/World/!"));
+  face.receive(*util::makeData("/Hello/World/!"));
   advanceClocks(time::milliseconds(10), 100);
 }
 
 BOOST_AUTO_TEST_CASE(removeAllPendingInterests)
 {
-  face->expressInterest(Interest("/Hello/World/0", time::milliseconds(50)),
-                        bind([] { BOOST_FAIL("Unexpected data"); }),
-                        bind([] { BOOST_FAIL("Unexpected nack"); }),
-                        bind([] { BOOST_FAIL("Unexpected timeout"); }));
+  face.expressInterest(Interest("/Hello/World/0", time::milliseconds(50)),
+                       bind([] { BOOST_FAIL("Unexpected data"); }),
+                       bind([] { BOOST_FAIL("Unexpected nack"); }),
+                       bind([] { BOOST_FAIL("Unexpected timeout"); }));
 
-  face->expressInterest(Interest("/Hello/World/1", time::milliseconds(50)),
-                        bind([] { BOOST_FAIL("Unexpected data"); }),
-                        bind([] { BOOST_FAIL("Unexpected nack"); }),
-                        bind([] { BOOST_FAIL("Unexpected timeout"); }));
+  face.expressInterest(Interest("/Hello/World/1", time::milliseconds(50)),
+                       bind([] { BOOST_FAIL("Unexpected data"); }),
+                       bind([] { BOOST_FAIL("Unexpected nack"); }),
+                       bind([] { BOOST_FAIL("Unexpected timeout"); }));
 
   advanceClocks(time::milliseconds(10));
 
-  face->removeAllPendingInterests();
+  face.removeAllPendingInterests();
   advanceClocks(time::milliseconds(10));
 
-  BOOST_CHECK_EQUAL(face->getNPendingInterests(), 0);
+  BOOST_CHECK_EQUAL(face.getNPendingInterests(), 0);
 
-  face->receive(*util::makeData("/Hello/World/0"));
-  face->receive(*util::makeData("/Hello/World/1"));
+  face.receive(*util::makeData("/Hello/World/0"));
+  face.receive(*util::makeData("/Hello/World/1"));
   advanceClocks(time::milliseconds(10), 100);
 }
 
@@ -274,41 +273,41 @@
   size_t nInterests = 0;
   size_t nRegs = 0;
   const RegisteredPrefixId* regPrefixId =
-    face->setInterestFilter("/Hello/World",
-                            bind([&nInterests] { ++nInterests; }),
-                            bind([&nRegs] { ++nRegs; }),
-                            bind([] {
-                                BOOST_FAIL("Unexpected setInterestFilter failure");
-                              }));
+    face.setInterestFilter("/Hello/World",
+                           bind([&nInterests] { ++nInterests; }),
+                           bind([&nRegs] { ++nRegs; }),
+                           bind([] {
+                               BOOST_FAIL("Unexpected setInterestFilter failure");
+                             }));
   advanceClocks(time::milliseconds(10), 10);
   BOOST_CHECK_EQUAL(nRegs, 1);
   BOOST_CHECK_EQUAL(nInterests, 0);
 
-  face->receive(Interest("/Hello/World/!"));
+  face.receive(Interest("/Hello/World/!"));
   advanceClocks(time::milliseconds(10), 10);
 
   BOOST_CHECK_EQUAL(nRegs, 1);
   BOOST_CHECK_EQUAL(nInterests, 1);
 
-  face->receive(Interest("/Bye/World/!"));
+  face.receive(Interest("/Bye/World/!"));
   advanceClocks(time::milliseconds(10000), 10);
   BOOST_CHECK_EQUAL(nInterests, 1);
 
-  face->receive(Interest("/Hello/World/!/2"));
+  face.receive(Interest("/Hello/World/!/2"));
   advanceClocks(time::milliseconds(10), 10);
   BOOST_CHECK_EQUAL(nInterests, 2);
 
   // removing filter
-  face->unsetInterestFilter(regPrefixId);
+  face.unsetInterestFilter(regPrefixId);
   advanceClocks(time::milliseconds(10), 10);
 
-  face->receive(Interest("/Hello/World/!/3"));
+  face.receive(Interest("/Hello/World/!/3"));
   BOOST_CHECK_EQUAL(nInterests, 2);
 
-  face->unsetInterestFilter(static_cast<const RegisteredPrefixId*>(0));
+  face.unsetInterestFilter(static_cast<const RegisteredPrefixId*>(0));
   advanceClocks(time::milliseconds(10), 10);
 
-  face->unsetInterestFilter(static_cast<const InterestFilterId*>(0));
+  face.unsetInterestFilter(static_cast<const InterestFilterId*>(0));
   advanceClocks(time::milliseconds(10), 10);
 }
 
@@ -316,38 +315,38 @@
 {
   size_t nInterests = 0;
   const RegisteredPrefixId* regPrefixId =
-    face->setInterestFilter("/Hello/World",
-                            bind([&nInterests] { ++nInterests; }),
-                            bind([] {
-                                BOOST_FAIL("Unexpected setInterestFilter failure");
-                              }));
+    face.setInterestFilter("/Hello/World",
+                           bind([&nInterests] { ++nInterests; }),
+                           bind([] {
+                               BOOST_FAIL("Unexpected setInterestFilter failure");
+                             }));
   advanceClocks(time::milliseconds(10), 10);
   BOOST_CHECK_EQUAL(nInterests, 0);
 
-  face->receive(Interest("/Hello/World/!"));
+  face.receive(Interest("/Hello/World/!"));
   advanceClocks(time::milliseconds(10), 10);
 
   BOOST_CHECK_EQUAL(nInterests, 1);
 
-  face->receive(Interest("/Bye/World/!"));
+  face.receive(Interest("/Bye/World/!"));
   advanceClocks(time::milliseconds(10000), 10);
   BOOST_CHECK_EQUAL(nInterests, 1);
 
-  face->receive(Interest("/Hello/World/!/2"));
+  face.receive(Interest("/Hello/World/!/2"));
   advanceClocks(time::milliseconds(10), 10);
   BOOST_CHECK_EQUAL(nInterests, 2);
 
   // removing filter
-  face->unsetInterestFilter(regPrefixId);
+  face.unsetInterestFilter(regPrefixId);
   advanceClocks(time::milliseconds(10), 10);
 
-  face->receive(Interest("/Hello/World/!/3"));
+  face.receive(Interest("/Hello/World/!/3"));
   BOOST_CHECK_EQUAL(nInterests, 2);
 
-  face->unsetInterestFilter(static_cast<const RegisteredPrefixId*>(0));
+  face.unsetInterestFilter(static_cast<const RegisteredPrefixId*>(0));
   advanceClocks(time::milliseconds(10), 10);
 
-  face->unsetInterestFilter(static_cast<const InterestFilterId*>(0));
+  face.unsetInterestFilter(static_cast<const InterestFilterId*>(0));
   advanceClocks(time::milliseconds(10), 10);
 }
 
@@ -355,16 +354,16 @@
 {
   // don't enable registration reply
   size_t nRegFailed = 0;
-  face->setInterestFilter("/Hello/World",
-                          bind([] {
-                              BOOST_FAIL("Unexpected Interest");
-                            }),
-                          bind([] {
-                              BOOST_FAIL("Unexpected success of setInterestFilter");
-                            }),
-                          bind([&nRegFailed] {
-                              ++nRegFailed;
-                            }));
+  face.setInterestFilter("/Hello/World",
+                         bind([] {
+                             BOOST_FAIL("Unexpected Interest");
+                           }),
+                         bind([] {
+                             BOOST_FAIL("Unexpected success of setInterestFilter");
+                           }),
+                         bind([&nRegFailed] {
+                             ++nRegFailed;
+                           }));
 
   advanceClocks(time::milliseconds(10), 10);
   BOOST_CHECK_EQUAL(nRegFailed, 0);
@@ -377,13 +376,13 @@
 {
   // don't enable registration reply
   size_t nRegFailed = 0;
-  face->setInterestFilter("/Hello/World",
-                          bind([] {
-                              BOOST_FAIL("Unexpected Interest");
-                            }),
-                          bind([&nRegFailed] {
-                              ++nRegFailed;
-                            }));
+  face.setInterestFilter("/Hello/World",
+                         bind([] {
+                             BOOST_FAIL("Unexpected Interest");
+                           }),
+                         bind([&nRegFailed] {
+                             ++nRegFailed;
+                           }));
 
   advanceClocks(time::milliseconds(10), 10);
   BOOST_CHECK_EQUAL(nRegFailed, 0);
@@ -396,21 +395,21 @@
 {
   size_t nRegSuccesses = 0;
   const RegisteredPrefixId* regPrefixId =
-    face->registerPrefix("/Hello/World",
-                         bind([&nRegSuccesses] { ++nRegSuccesses; }),
-                         bind([] {
-                             BOOST_FAIL("Unexpected registerPrefix failure");
-                           }));
+    face.registerPrefix("/Hello/World",
+                        bind([&nRegSuccesses] { ++nRegSuccesses; }),
+                        bind([] {
+                            BOOST_FAIL("Unexpected registerPrefix failure");
+                          }));
 
   advanceClocks(time::milliseconds(10), 10);
   BOOST_CHECK_EQUAL(nRegSuccesses, 1);
 
   size_t nUnregSuccesses = 0;
-  face->unregisterPrefix(regPrefixId,
-                         bind([&nUnregSuccesses] { ++nUnregSuccesses; }),
-                         bind([] {
-                             BOOST_FAIL("Unexpected unregisterPrefix failure");
-                           }));
+  face.unregisterPrefix(regPrefixId,
+                        bind([&nUnregSuccesses] { ++nUnregSuccesses; }),
+                        bind([] {
+                            BOOST_FAIL("Unexpected unregisterPrefix failure");
+                          }));
 
   advanceClocks(time::milliseconds(10), 10);
   BOOST_CHECK_EQUAL(nUnregSuccesses, 1);
@@ -419,11 +418,11 @@
 BOOST_FIXTURE_TEST_CASE(RegisterUnregisterPrefixFail, FacesNoRegistrationReplyFixture)
 {
   size_t nRegFailures = 0;
-  face->registerPrefix("/Hello/World",
-                       bind([] {
-                           BOOST_FAIL("Unexpected registerPrefix success");
-                         }),
-                       bind([&nRegFailures] { ++nRegFailures; }));
+  face.registerPrefix("/Hello/World",
+                      bind([] {
+                          BOOST_FAIL("Unexpected registerPrefix success");
+                        }),
+                      bind([&nRegFailures] { ++nRegFailures; }));
 
   advanceClocks(time::milliseconds(1000), 100);
   BOOST_CHECK_EQUAL(nRegFailures, 1);
@@ -432,32 +431,32 @@
 BOOST_AUTO_TEST_CASE(SimilarFilters)
 {
   size_t nInInterests1 = 0;
-  face->setInterestFilter("/Hello/World",
-                          bind([&nInInterests1] { ++nInInterests1; }),
-                          RegisterPrefixSuccessCallback(),
-                          bind([] {
-                              BOOST_FAIL("Unexpected setInterestFilter failure");
-                            }));
+  face.setInterestFilter("/Hello/World",
+                         bind([&nInInterests1] { ++nInInterests1; }),
+                         RegisterPrefixSuccessCallback(),
+                         bind([] {
+                             BOOST_FAIL("Unexpected setInterestFilter failure");
+                           }));
 
   size_t nInInterests2 = 0;
-  face->setInterestFilter("/Hello",
-                          bind([&nInInterests2] { ++nInInterests2; }),
-                          RegisterPrefixSuccessCallback(),
-                          bind([] {
-                              BOOST_FAIL("Unexpected setInterestFilter failure");
-                            }));
+  face.setInterestFilter("/Hello",
+                         bind([&nInInterests2] { ++nInInterests2; }),
+                         RegisterPrefixSuccessCallback(),
+                         bind([] {
+                             BOOST_FAIL("Unexpected setInterestFilter failure");
+                           }));
 
   size_t nInInterests3 = 0;
-  face->setInterestFilter("/Los/Angeles/Lakers",
-                          bind([&nInInterests3] { ++nInInterests3; }),
-                          RegisterPrefixSuccessCallback(),
-                          bind([] {
-                              BOOST_FAIL("Unexpected setInterestFilter failure");
-                            }));
+  face.setInterestFilter("/Los/Angeles/Lakers",
+                         bind([&nInInterests3] { ++nInInterests3; }),
+                         RegisterPrefixSuccessCallback(),
+                         bind([] {
+                             BOOST_FAIL("Unexpected setInterestFilter failure");
+                           }));
 
   advanceClocks(time::milliseconds(10), 10);
 
-  face->receive(Interest("/Hello/World/!"));
+  face.receive(Interest("/Hello/World/!"));
   advanceClocks(time::milliseconds(10), 10);
 
   BOOST_CHECK_EQUAL(nInInterests1, 1);
@@ -467,71 +466,71 @@
 
 BOOST_AUTO_TEST_CASE(SetRegexFilterError)
 {
-  face->setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
-                          [] (const Name&, const Interest&) {
-                            BOOST_FAIL("InterestFilter::Error should have been triggered");
-                          },
-                          RegisterPrefixSuccessCallback(),
-                          bind([] {
-                              BOOST_FAIL("Unexpected setInterestFilter failure");
-                            }));
+  face.setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
+                         [] (const Name&, const Interest&) {
+                           BOOST_FAIL("InterestFilter::Error should have been triggered");
+                         },
+                         RegisterPrefixSuccessCallback(),
+                         bind([] {
+                             BOOST_FAIL("Unexpected setInterestFilter failure");
+                           }));
 
   advanceClocks(time::milliseconds(10), 10);
 
-  BOOST_REQUIRE_THROW(face->receive(Interest("/Hello/World/XXX/b/c")), InterestFilter::Error);
+  BOOST_REQUIRE_THROW(face.receive(Interest("/Hello/World/XXX/b/c")), InterestFilter::Error);
 }
 
 BOOST_AUTO_TEST_CASE(SetRegexFilter)
 {
   size_t nInInterests = 0;
-  face->setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
-                          bind([&nInInterests] { ++nInInterests; }),
-                          RegisterPrefixSuccessCallback(),
-                          bind([] {
-                              BOOST_FAIL("Unexpected setInterestFilter failure");
-                            }));
+  face.setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
+                         bind([&nInInterests] { ++nInInterests; }),
+                         RegisterPrefixSuccessCallback(),
+                         bind([] {
+                             BOOST_FAIL("Unexpected setInterestFilter failure");
+                           }));
 
   advanceClocks(time::milliseconds(10), 10);
 
-  face->receive(Interest("/Hello/World/a"));     // shouldn't match
+  face.receive(Interest("/Hello/World/a"));     // shouldn't match
   BOOST_CHECK_EQUAL(nInInterests, 0);
 
-  face->receive(Interest("/Hello/World/a/b"));   // should match
+  face.receive(Interest("/Hello/World/a/b"));   // should match
   BOOST_CHECK_EQUAL(nInInterests, 1);
 
-  face->receive(Interest("/Hello/World/a/b/c")); // should match
+  face.receive(Interest("/Hello/World/a/b/c")); // should match
   BOOST_CHECK_EQUAL(nInInterests, 2);
 
-  face->receive(Interest("/Hello/World/a/b/d")); // should not match
+  face.receive(Interest("/Hello/World/a/b/d")); // should not match
   BOOST_CHECK_EQUAL(nInInterests, 2);
 }
 
 BOOST_AUTO_TEST_CASE(SetRegexFilterAndRegister)
 {
   size_t nInInterests = 0;
-  face->setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
-                          bind([&nInInterests] { ++nInInterests; }));
+  face.setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
+                         bind([&nInInterests] { ++nInInterests; }));
 
   size_t nRegSuccesses = 0;
-  face->registerPrefix("/Hello/World",
-                       bind([&nRegSuccesses] { ++nRegSuccesses; }),
-                       bind([] {
-                           BOOST_FAIL("Unexpected setInterestFilter failure");
-                         }));
+  face.registerPrefix("/Hello/World",
+                      bind([&nRegSuccesses] { ++nRegSuccesses; }),
+                      bind([] {
+                          BOOST_FAIL("Unexpected setInterestFilter failure");
+                        }));
 
   advanceClocks(time::milliseconds(10), 10);
   BOOST_CHECK_EQUAL(nRegSuccesses, 1);
 
-  face->receive(Interest("/Hello/World/a")); // shouldn't match
+  face.receive(Interest("/Hello/World/a")); // shouldn't match
   BOOST_CHECK_EQUAL(nInInterests, 0);
 
-  face->receive(Interest("/Hello/World/a/b")); // should match
+  face.receive(Interest("/Hello/World/a/b")); // should match
   BOOST_CHECK_EQUAL(nInInterests, 1);
 
-  face->receive(Interest("/Hello/World/a/b/c")); // should match
+  face.receive(Interest("/Hello/World/a/b/c")); // should match
   BOOST_CHECK_EQUAL(nInInterests, 2);
 
-  face->receive(Interest("/Hello/World/a/b/d")); // should not match
+  face.receive(Interest("/Hello/World/a/b/d")); // should not match
   BOOST_CHECK_EQUAL(nInInterests, 2);
 }
 
@@ -541,32 +540,32 @@
   // Regular Face won't accept incoming packets until something is sent.
 
   int hit = 0;
-  face->setInterestFilter(Name("/"), bind([&hit] { ++hit; }));
-  face->processEvents(time::milliseconds(-1));
+  face.setInterestFilter(Name("/"), bind([&hit] { ++hit; }));
+  face.processEvents(time::milliseconds(-1));
 
   auto interest = make_shared<Interest>("/A");
-  face->receive(*interest);
-  face->processEvents(time::milliseconds(-1));
+  face.receive(*interest);
+  face.processEvents(time::milliseconds(-1));
 
   BOOST_CHECK_EQUAL(hit, 1);
 }
 
 BOOST_AUTO_TEST_CASE(ProcessEvents)
 {
-  face->processEvents(time::milliseconds(-1)); // io_service::reset()/poll() inside
+  face.processEvents(time::milliseconds(-1)); // io_service::reset()/poll() inside
 
   size_t nRegSuccesses = 0;
-  face->registerPrefix("/Hello/World",
-                       bind([&nRegSuccesses] { ++nRegSuccesses; }),
-                       bind([] {
-                           BOOST_FAIL("Unexpected setInterestFilter failure");
-                         }));
+  face.registerPrefix("/Hello/World",
+                      bind([&nRegSuccesses] { ++nRegSuccesses; }),
+                      bind([] {
+                          BOOST_FAIL("Unexpected setInterestFilter failure");
+                        }));
 
   // io_service::poll() without reset
-  face->getIoService().poll();
+  face.getIoService().poll();
   BOOST_CHECK_EQUAL(nRegSuccesses, 0);
 
-  face->processEvents(time::milliseconds(-1)); // io_service::reset()/poll() inside
+  face.processEvents(time::milliseconds(-1)); // io_service::reset()/poll() inside
   BOOST_CHECK_EQUAL(nRegSuccesses, 1);
 }
 
@@ -575,22 +574,23 @@
   lp::Nack nack(Interest("/Hello/World", time::milliseconds(50)));
   nack.setReason(lp::NackReason::NO_ROUTE);
 
-  BOOST_CHECK_EQUAL(face->sentNacks.size(), 0);
+  BOOST_CHECK_EQUAL(face.sentNacks.size(), 0);
 
-  face->put(nack);
+  face.put(nack);
 
   advanceClocks(time::milliseconds(10));
 
-  BOOST_CHECK_EQUAL(face->sentNacks.size(), 1);
+  BOOST_CHECK_EQUAL(face.sentNacks.size(), 1);
 }
 
 BOOST_AUTO_TEST_CASE(DestructionWithoutCancellingPendingInterests) // Bug #2518
 {
-  face->expressInterest(Interest("/Hello/World", time::milliseconds(50)),
-                        bind([]{}), bind([]{}));
-  advanceClocks(time::milliseconds(10), 10);
-
-  face.reset();
+  {
+    DummyClientFace face2(io);
+    face2.expressInterest(Interest("/Hello/World", time::milliseconds(50)),
+                          bind([]{}), bind([]{}));
+    advanceClocks(time::milliseconds(10), 10);
+  }
 
   advanceClocks(time::milliseconds(10), 10);
   // should not segfault
diff --git a/tests/unit-tests/management/nfd-controller.t.cpp b/tests/unit-tests/management/nfd-controller.t.cpp
index 6479cd6..2379d5c 100644
--- a/tests/unit-tests/management/nfd-controller.t.cpp
+++ b/tests/unit-tests/management/nfd-controller.t.cpp
@@ -34,7 +34,6 @@
 namespace tests {
 
 using ndn::util::DummyClientFace;
-using ndn::util::makeDummyClientFace;
 
 BOOST_AUTO_TEST_SUITE(Management)
 
@@ -42,8 +41,8 @@
 {
 protected:
   CommandFixture()
-    : face(makeDummyClientFace(io))
-    , controller(*face, keyChain)
+    : face(io)
+    , controller(face, keyChain)
     , commandSucceedCallback(bind(&CommandFixture::onCommandSucceed, this, _1))
     , commandFailCallback(bind(&CommandFixture::onCommandFail, this, _1, _2))
   {
@@ -63,7 +62,7 @@
   }
 
 protected:
-  shared_ptr<DummyClientFace> face;
+  DummyClientFace face;
   KeyChain keyChain;
   Controller controller;
 
@@ -90,8 +89,8 @@
 
   advanceClocks(time::milliseconds(1));
 
-  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
-  const Interest& requestInterest = face->sentInterests[0];
+  BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
+  const Interest& requestInterest = face.sentInterests[0];
 
   FaceCreateCommand command;
   BOOST_CHECK(Name("/localhost/nfd/faces/create").isPrefixOf(requestInterest.getName()));
@@ -113,7 +112,7 @@
 
   auto responseData = util::makeData(requestInterest.getName());
   responseData->setContent(responsePayload.wireEncode());
-  face->receive(*responseData);
+  face.receive(*responseData);
 
   advanceClocks(time::milliseconds(1));
 
@@ -148,14 +147,14 @@
                          commandFailCallback));
   advanceClocks(time::milliseconds(1));
 
-  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
-  const Interest& requestInterest = face->sentInterests[0];
+  BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
+  const Interest& requestInterest = face.sentInterests[0];
 
   ControlResponse responsePayload(401, "Not Authenticated");
 
   auto responseData = util::makeData(requestInterest.getName());
   responseData->setContent(responsePayload.wireEncode());
-  face->receive(*responseData);
+  face.receive(*responseData);
   advanceClocks(time::milliseconds(1));
 
   BOOST_CHECK_EQUAL(commandSucceedHistory.size(), 0);
@@ -174,8 +173,8 @@
                          commandFailCallback));
   advanceClocks(time::milliseconds(1));
 
-  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
-  const Interest& requestInterest = face->sentInterests[0];
+  BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
+  const Interest& requestInterest = face.sentInterests[0];
 
   ControlParameters responseBody;
   responseBody.setUri("tcp4://192.0.2.1:6363")
@@ -186,7 +185,7 @@
 
   auto responseData = util::makeData(requestInterest.getName());
   responseData->setContent(responsePayload.wireEncode());
-  face->receive(*responseData);
+  face.receive(*responseData);
   advanceClocks(time::milliseconds(1));
 
   BOOST_CHECK_EQUAL(commandSucceedHistory.size(), 0);
@@ -204,11 +203,11 @@
                        commandFailCallback));
   advanceClocks(time::milliseconds(1));
 
-  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
-  const Interest& requestInterest = face->sentInterests[0];
+  BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
+  const Interest& requestInterest = face.sentInterests[0];
 
   auto responseNack = util::makeNack(requestInterest, lp::NackReason::NO_ROUTE);
-  face->receive(responseNack);
+  face.receive(responseNack);
   advanceClocks(time::milliseconds(1));
 
   BOOST_REQUIRE_EQUAL(commandFailHistory.size(), 1);
@@ -231,8 +230,8 @@
                        options));
   advanceClocks(time::milliseconds(1));
 
-  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
-  const Interest& requestInterest = face->sentInterests[0];
+  BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
+  const Interest& requestInterest = face.sentInterests[0];
 
   FaceCreateCommand command;
   BOOST_CHECK(Name("/localhop/net/example/router1/nfd/rib/register").isPrefixOf(
diff --git a/tests/unit-tests/mgmt/dispatcher.t.cpp b/tests/unit-tests/mgmt/dispatcher.t.cpp
index 2fbcd4f..1e7ff30 100644
--- a/tests/unit-tests/mgmt/dispatcher.t.cpp
+++ b/tests/unit-tests/mgmt/dispatcher.t.cpp
@@ -42,13 +42,13 @@
 {
 public:
   DispatcherFixture()
-    : face(util::makeDummyClientFace(io, {true, true}))
-    , dispatcher(*face, m_keyChain, security::SigningInfo())
+    : face(io, {true, true})
+    , dispatcher(face, m_keyChain, security::SigningInfo())
   {
   }
 
 public:
-  shared_ptr<util::DummyClientFace> face;
+  util::DummyClientFace face;
   mgmt::Dispatcher dispatcher;
 };
 
@@ -157,7 +157,7 @@
                                        bind([] { return true; }),
                                        bind([&nCallbackCalled] { ++nCallbackCalled["test/2"]; }));
 
-  face->receive(*util::makeInterest("/root/1/test/1/%80%00"));
+  face.receive(*util::makeInterest("/root/1/test/1/%80%00"));
   advanceClocks(time::milliseconds(1));
   BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 0);
   BOOST_CHECK_EQUAL(nCallbackCalled["test/2"], 0);
@@ -165,18 +165,18 @@
   dispatcher.addTopPrefix("/root/1");
   advanceClocks(time::milliseconds(1));
 
-  face->receive(*util::makeInterest("/root/1/test/1/%80%00"));
+  face.receive(*util::makeInterest("/root/1/test/1/%80%00"));
   advanceClocks(time::milliseconds(1));
   BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 1);
   BOOST_CHECK_EQUAL(nCallbackCalled["test/2"], 0);
 
-  face->receive(*util::makeInterest("/root/1/test/2/%80%00"));
+  face.receive(*util::makeInterest("/root/1/test/2/%80%00"));
   advanceClocks(time::milliseconds(1));
   BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 1);
   BOOST_CHECK_EQUAL(nCallbackCalled["test/2"], 1);
 
-  face->receive(*util::makeInterest("/root/2/test/1/%80%00"));
-  face->receive(*util::makeInterest("/root/2/test/2/%80%00"));
+  face.receive(*util::makeInterest("/root/2/test/1/%80%00"));
+  face.receive(*util::makeInterest("/root/2/test/2/%80%00"));
   advanceClocks(time::milliseconds(1));
   BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 1);
   BOOST_CHECK_EQUAL(nCallbackCalled["test/2"], 1);
@@ -184,22 +184,22 @@
   dispatcher.addTopPrefix("/root/2");
   advanceClocks(time::milliseconds(1));
 
-  face->receive(*util::makeInterest("/root/1/test/1/%80%00"));
+  face.receive(*util::makeInterest("/root/1/test/1/%80%00"));
   advanceClocks(time::milliseconds(1));
   BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 2);
 
-  face->receive(*util::makeInterest("/root/2/test/1/%80%00"));
+  face.receive(*util::makeInterest("/root/2/test/1/%80%00"));
   advanceClocks(time::milliseconds(1));
   BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 3);
 
   dispatcher.removeTopPrefix("/root/1");
   advanceClocks(time::milliseconds(1));
 
-  face->receive(*util::makeInterest("/root/1/test/1/%80%00"));
+  face.receive(*util::makeInterest("/root/1/test/1/%80%00"));
   advanceClocks(time::milliseconds(1));
   BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 3);
 
-  face->receive(*util::makeInterest("/root/2/test/1/%80%00"));
+  face.receive(*util::makeInterest("/root/2/test/1/%80%00"));
   advanceClocks(time::milliseconds(1));
   BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 4);
 }
@@ -215,23 +215,23 @@
 
   dispatcher.addTopPrefix("/root");
   advanceClocks(time::milliseconds(1));
-  face->sentDatas.clear();
+  face.sentData.clear();
 
-  face->receive(*util::makeInterest("/root/test/%80%00")); // returns 403
-  face->receive(*util::makeInterest("/root/test/%80%00/invalid")); // returns 403
-  face->receive(*util::makeInterest("/root/test/%80%00/silent")); // silently ignored
-  face->receive(*util::makeInterest("/root/test/.../invalid")); // silently ignored (wrong format)
-  face->receive(*util::makeInterest("/root/test/.../valid"));  // silently ignored (wrong format)
+  face.receive(*util::makeInterest("/root/test/%80%00")); // returns 403
+  face.receive(*util::makeInterest("/root/test/%80%00/invalid")); // returns 403
+  face.receive(*util::makeInterest("/root/test/%80%00/silent")); // silently ignored
+  face.receive(*util::makeInterest("/root/test/.../invalid")); // silently ignored (wrong format)
+  face.receive(*util::makeInterest("/root/test/.../valid"));  // silently ignored (wrong format)
   advanceClocks(time::milliseconds(1), 20);
   BOOST_CHECK_EQUAL(nCallbackCalled, 0);
-  BOOST_CHECK_EQUAL(face->sentDatas.size(), 2);
+  BOOST_CHECK_EQUAL(face.sentData.size(), 2);
 
-  BOOST_CHECK(face->sentDatas[0].getContentType() == tlv::ContentType_Blob);
-  BOOST_CHECK_EQUAL(ControlResponse(face->sentDatas[0].getContent().blockFromValue()).getCode(), 403);
-  BOOST_CHECK(face->sentDatas[1].getContentType() == tlv::ContentType_Blob);
-  BOOST_CHECK_EQUAL(ControlResponse(face->sentDatas[1].getContent().blockFromValue()).getCode(), 403);
+  BOOST_CHECK(face.sentData[0].getContentType() == tlv::ContentType_Blob);
+  BOOST_CHECK_EQUAL(ControlResponse(face.sentData[0].getContent().blockFromValue()).getCode(), 403);
+  BOOST_CHECK(face.sentData[1].getContentType() == tlv::ContentType_Blob);
+  BOOST_CHECK_EQUAL(ControlResponse(face.sentData[1].getContent().blockFromValue()).getCode(), 403);
 
-  face->receive(*util::makeInterest("/root/test/%80%00/valid"));
+  face.receive(*util::makeInterest("/root/test/%80%00/valid"));
   advanceClocks(time::milliseconds(1), 10);
   BOOST_CHECK_EQUAL(nCallbackCalled, 1);
 }
@@ -278,30 +278,30 @@
 
   dispatcher.addTopPrefix("/root");
   advanceClocks(time::milliseconds(1));
-  face->sentDatas.clear();
+  face.sentData.clear();
 
-  face->receive(*util::makeInterest("/root/test/small/%80%00")); // returns 403
-  face->receive(*util::makeInterest("/root/test/small/%80%00/invalid")); // returns 403
-  face->receive(*util::makeInterest("/root/test/small/%80%00/silent")); // silently ignored
+  face.receive(*util::makeInterest("/root/test/small/%80%00")); // returns 403
+  face.receive(*util::makeInterest("/root/test/small/%80%00/invalid")); // returns 403
+  face.receive(*util::makeInterest("/root/test/small/%80%00/silent")); // silently ignored
   advanceClocks(time::milliseconds(1), 20);
-  BOOST_CHECK_EQUAL(face->sentDatas.size(), 2);
+  BOOST_CHECK_EQUAL(face.sentData.size(), 2);
 
-  BOOST_CHECK(face->sentDatas[0].getContentType() == tlv::ContentType_Blob);
-  BOOST_CHECK_EQUAL(ControlResponse(face->sentDatas[0].getContent().blockFromValue()).getCode(), 403);
-  BOOST_CHECK(face->sentDatas[1].getContentType() == tlv::ContentType_Blob);
-  BOOST_CHECK_EQUAL(ControlResponse(face->sentDatas[1].getContent().blockFromValue()).getCode(), 403);
+  BOOST_CHECK(face.sentData[0].getContentType() == tlv::ContentType_Blob);
+  BOOST_CHECK_EQUAL(ControlResponse(face.sentData[0].getContent().blockFromValue()).getCode(), 403);
+  BOOST_CHECK(face.sentData[1].getContentType() == tlv::ContentType_Blob);
+  BOOST_CHECK_EQUAL(ControlResponse(face.sentData[1].getContent().blockFromValue()).getCode(), 403);
 
-  face->sentDatas.clear();
-  face->receive(*util::makeInterest("/root/test/small/valid"));
+  face.sentData.clear();
+  face.receive(*util::makeInterest("/root/test/small/valid"));
   advanceClocks(time::milliseconds(1), 10);
-  BOOST_CHECK_EQUAL(face->sentDatas.size(), 1);
+  BOOST_CHECK_EQUAL(face.sentData.size(), 1);
 
-  face->receive(*util::makeInterest(Name("/root/test/small/valid").appendVersion(10))); // should be ignored
-  face->receive(*util::makeInterest(Name("/root/test/small/valid").appendSegment(20))); // should be ignored
+  face.receive(*util::makeInterest(Name("/root/test/small/valid").appendVersion(10))); // should be ignored
+  face.receive(*util::makeInterest(Name("/root/test/small/valid").appendSegment(20))); // should be ignored
   advanceClocks(time::milliseconds(1), 10);
-  BOOST_CHECK_EQUAL(face->sentDatas.size(), 1);
+  BOOST_CHECK_EQUAL(face.sentData.size(), 1);
 
-  Block content = face->sentDatas[0].getContent();
+  Block content = face.sentData[0].getContent();
   BOOST_CHECK_NO_THROW(content.parse());
 
   BOOST_CHECK_EQUAL(content.elements().size(), 3);
@@ -309,12 +309,12 @@
   BOOST_CHECK(content.elements()[1] == smallBlock);
   BOOST_CHECK(content.elements()[2] == smallBlock);
 
-  face->sentDatas.clear();
-  face->receive(*util::makeInterest("/root/test/large/valid"));
+  face.sentData.clear();
+  face.receive(*util::makeInterest("/root/test/large/valid"));
   advanceClocks(time::milliseconds(1), 10);
-  BOOST_CHECK_EQUAL(face->sentDatas.size(), 2);
+  BOOST_CHECK_EQUAL(face.sentData.size(), 2);
 
-  const auto& datas = face->sentDatas;
+  const auto& datas = face.sentData;
   content = [&datas] () -> Block {
     EncodingBuffer encoder;
     size_t valueLength = encoder.prependByteArray(datas[1].getContent().value(),
@@ -333,12 +333,12 @@
   BOOST_CHECK(content.elements()[1] == largeBlock);
   BOOST_CHECK(content.elements()[2] == largeBlock);
 
-  face->sentDatas.clear();
-  face->receive(*util::makeInterest("/root/test/reject/%80%00/valid")); // returns nack
+  face.sentData.clear();
+  face.receive(*util::makeInterest("/root/test/reject/%80%00/valid")); // returns nack
   advanceClocks(time::milliseconds(1));
-  BOOST_CHECK_EQUAL(face->sentDatas.size(), 1);
-  BOOST_CHECK(face->sentDatas[0].getContentType() == tlv::ContentType_Nack);
-  BOOST_CHECK_EQUAL(ControlResponse(face->sentDatas[0].getContent().blockFromValue()).getCode(), 400);
+  BOOST_CHECK_EQUAL(face.sentData.size(), 1);
+  BOOST_CHECK(face.sentData[0].getContentType() == tlv::ContentType_Nack);
+  BOOST_CHECK_EQUAL(ControlResponse(face.sentData[0].getContent().blockFromValue()).getCode(), 400);
 }
 
 BOOST_FIXTURE_TEST_CASE(NotificationStream, DispatcherFixture)
@@ -349,31 +349,31 @@
 
   post(block);
   advanceClocks(time::milliseconds(1));
-  BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
+  BOOST_CHECK_EQUAL(face.sentData.size(), 0);
 
   dispatcher.addTopPrefix("/root");
   advanceClocks(time::milliseconds(1));
-  face->sentDatas.clear();
+  face.sentData.clear();
 
   post(block);
   advanceClocks(time::milliseconds(1));
-  BOOST_CHECK_EQUAL(face->sentDatas.size(), 1);
+  BOOST_CHECK_EQUAL(face.sentData.size(), 1);
 
   post(block);
   post(block);
   post(block);
   advanceClocks(time::milliseconds(1), 10);
 
-  BOOST_CHECK_EQUAL(face->sentDatas.size(), 4);
-  BOOST_CHECK_EQUAL(face->sentDatas[0].getName(), "/root/test/%FE%00");
-  BOOST_CHECK_EQUAL(face->sentDatas[1].getName(), "/root/test/%FE%01");
-  BOOST_CHECK_EQUAL(face->sentDatas[2].getName(), "/root/test/%FE%02");
-  BOOST_CHECK_EQUAL(face->sentDatas[3].getName(), "/root/test/%FE%03");
+  BOOST_CHECK_EQUAL(face.sentData.size(), 4);
+  BOOST_CHECK_EQUAL(face.sentData[0].getName(), "/root/test/%FE%00");
+  BOOST_CHECK_EQUAL(face.sentData[1].getName(), "/root/test/%FE%01");
+  BOOST_CHECK_EQUAL(face.sentData[2].getName(), "/root/test/%FE%02");
+  BOOST_CHECK_EQUAL(face.sentData[3].getName(), "/root/test/%FE%03");
 
-  BOOST_CHECK(face->sentDatas[0].getContent().blockFromValue() == block);
-  BOOST_CHECK(face->sentDatas[1].getContent().blockFromValue() == block);
-  BOOST_CHECK(face->sentDatas[2].getContent().blockFromValue() == block);
-  BOOST_CHECK(face->sentDatas[3].getContent().blockFromValue() == block);
+  BOOST_CHECK(face.sentData[0].getContent().blockFromValue() == block);
+  BOOST_CHECK(face.sentData[1].getContent().blockFromValue() == block);
+  BOOST_CHECK(face.sentData[2].getContent().blockFromValue() == block);
+  BOOST_CHECK(face.sentData[3].getContent().blockFromValue() == block);
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/unit-tests/security/validator-config.t.cpp b/tests/unit-tests/security/validator-config.t.cpp
index 63eee74..813d28c 100644
--- a/tests/unit-tests/security/validator-config.t.cpp
+++ b/tests/unit-tests/security/validator-config.t.cpp
@@ -1134,8 +1134,8 @@
 struct FacesFixture : public security::IdentityManagementTimeFixture
 {
   FacesFixture()
-    : face1(util::makeDummyClientFace(io, {true, true}))
-    , face2(util::makeDummyClientFace(io, {true, true}))
+    : face1(io, {true, true})
+    , face2(io, {true, true})
     , readInterestOffset1(0)
     , readDataOffset1(0)
     , readInterestOffset2(0)
@@ -1148,10 +1148,10 @@
   {
     bool hasPassed = false;
 
-    checkFace(face1->sentInterests, readInterestOffset1, *face2, hasPassed);
-    checkFace(face1->sentDatas, readDataOffset1, *face2, hasPassed);
-    checkFace(face2->sentInterests, readInterestOffset2, *face1, hasPassed);
-    checkFace(face2->sentInterests, readDataOffset2, *face1, hasPassed);
+    checkFace(face1.sentInterests, readInterestOffset1, face2, hasPassed);
+    checkFace(face1.sentData, readDataOffset1, face2, hasPassed);
+    checkFace(face2.sentInterests, readInterestOffset2, face1, hasPassed);
+    checkFace(face2.sentInterests, readDataOffset2, face1, hasPassed);
 
     return hasPassed;
   }
@@ -1175,8 +1175,8 @@
   }
 
 public:
-  shared_ptr<util::DummyClientFace> face1;
-  shared_ptr<util::DummyClientFace> face2;
+  util::DummyClientFace face1;
+  util::DummyClientFace face2;
 
   size_t readInterestOffset1;
   size_t readDataOffset1;
@@ -1225,13 +1225,13 @@
                                         sld));
   m_keyChain.addCertificateAsIdentityDefault(*nldCert);
 
-  face1->setInterestFilter(sldCert->getName().getPrefix(-1),
-    [&] (const InterestFilter&, const Interest&) { face1->put(*sldCert); },
+  face1.setInterestFilter(sldCert->getName().getPrefix(-1),
+    [&] (const InterestFilter&, const Interest&) { face1.put(*sldCert); },
     RegisterPrefixSuccessCallback(),
     [] (const Name&, const std::string&) {});
 
-  face1->setInterestFilter(nldCert->getName().getPrefix(-1),
-    [&] (const InterestFilter&, const Interest&) { face1->put(*nldCert); },
+  face1.setInterestFilter(nldCert->getName().getPrefix(-1),
+    [&] (const InterestFilter&, const Interest&) { face1.put(*nldCert); },
     RegisterPrefixSuccessCallback(),
     [] (const Name&, const std::string&) {});
 
@@ -1270,7 +1270,7 @@
     (boost::filesystem::current_path() / std::string("unit-test-nfd.conf"));
 
 
-  auto validator = make_shared<ValidatorConfig>(face2.get());
+  auto validator = make_shared<ValidatorConfig>(&face2);
   validator->load(CONFIG, CONFIG_PATH.native());
 
   advanceClocks(time::milliseconds(2), 100);
@@ -1338,13 +1338,13 @@
                                         sld));
   m_keyChain.addCertificateAsIdentityDefault(*nldCert);
 
-  face1->setInterestFilter(sldCert->getName().getPrefix(-1),
-    [&] (const InterestFilter&, const Interest&) { face1->put(*sldCert); },
+  face1.setInterestFilter(sldCert->getName().getPrefix(-1),
+    [&] (const InterestFilter&, const Interest&) { face1.put(*sldCert); },
     RegisterPrefixSuccessCallback(),
     [] (const Name&, const std::string&) {});
 
-  face1->setInterestFilter(nldCert->getName().getPrefix(-1),
-    [&] (const InterestFilter&, const Interest&) { face1->put(*nldCert); },
+  face1.setInterestFilter(nldCert->getName().getPrefix(-1),
+    [&] (const InterestFilter&, const Interest&) { face1.put(*nldCert); },
     RegisterPrefixSuccessCallback(),
     [] (const Name&, const std::string&) {});
 
@@ -1417,8 +1417,7 @@
   const boost::filesystem::path CONFIG_PATH =
     (boost::filesystem::current_path() / std::string("unit-test-nfd.conf"));
 
-
-  auto validator = make_shared<ValidatorConfig>(face2.get());
+  auto validator = make_shared<ValidatorConfig>(&face2);
   validator->load(CONFIG, CONFIG_PATH.native());
 
   advanceClocks(time::milliseconds(2), 100);
@@ -1467,8 +1466,8 @@
 struct DirTestFixture : public security::IdentityManagementTimeFixture
 {
   DirTestFixture()
-    : face(util::makeDummyClientFace(io, {true, true}))
-    , validator(face.get(), ValidatorConfig::DEFAULT_CERTIFICATE_CACHE,
+    : face(io, {true, true})
+    , validator(&face, ValidatorConfig::DEFAULT_CERTIFICATE_CACHE,
                 ValidatorConfig::DEFAULT_GRACE_INTERVAL, 0)
   {
     certDirPath = (boost::filesystem::current_path() / std::string("test-cert-dir"));
@@ -1510,7 +1509,7 @@
   shared_ptr<IdentityCertificate> firstCert;
   shared_ptr<IdentityCertificate> secondCert;
 
-  shared_ptr<util::DummyClientFace> face;
+  util::DummyClientFace face;
   ValidatorConfig validator;
 };
 
diff --git a/tests/unit-tests/util/notification-stream.t.cpp b/tests/unit-tests/util/notification-stream.t.cpp
index fb91f5e..0b15e61 100644
--- a/tests/unit-tests/util/notification-stream.t.cpp
+++ b/tests/unit-tests/util/notification-stream.t.cpp
@@ -60,9 +60,9 @@
 
 BOOST_AUTO_TEST_CASE(Post)
 {
-  shared_ptr<DummyClientFace> face = makeDummyClientFace(io);
+  DummyClientFace face(io);
   ndn::KeyChain keyChain;
-  util::NotificationStream<SimpleNotification> notificationStream(*face,
+  util::NotificationStream<SimpleNotification> notificationStream(face,
     "/localhost/nfd/NotificationStreamTest", keyChain);
 
   SimpleNotification event1("msg1");
@@ -70,11 +70,11 @@
 
   advanceClocks(time::milliseconds(1));
 
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
-  BOOST_CHECK_EQUAL(face->sentDatas[0].getName(),
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+  BOOST_CHECK_EQUAL(face.sentData[0].getName(),
                     "/localhost/nfd/NotificationStreamTest/%FE%00");
   SimpleNotification decoded1;
-  BOOST_CHECK_NO_THROW(decoded1.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_CHECK_NO_THROW(decoded1.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(decoded1.getMessage(), "msg1");
 
   SimpleNotification event2("msg2");
@@ -82,11 +82,11 @@
 
   advanceClocks(time::milliseconds(1));
 
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 2);
-  BOOST_CHECK_EQUAL(face->sentDatas[1].getName(),
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 2);
+  BOOST_CHECK_EQUAL(face.sentData[1].getName(),
                     "/localhost/nfd/NotificationStreamTest/%FE%01");
   SimpleNotification decoded2;
-  BOOST_CHECK_NO_THROW(decoded2.wireDecode(face->sentDatas[1].getContent().blockFromValue()));
+  BOOST_CHECK_NO_THROW(decoded2.wireDecode(face.sentData[1].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(decoded2.getMessage(), "msg2");
 }
 
diff --git a/tests/unit-tests/util/notification-subscriber.t.cpp b/tests/unit-tests/util/notification-subscriber.t.cpp
index 4fa222b..8dc1e60 100644
--- a/tests/unit-tests/util/notification-subscriber.t.cpp
+++ b/tests/unit-tests/util/notification-subscriber.t.cpp
@@ -44,10 +44,10 @@
 public:
   EndToEndFixture()
     : streamPrefix("ndn:/NotificationSubscriberTest")
-    , publisherFace(makeDummyClientFace(io))
-    , notificationStream(*publisherFace, streamPrefix, publisherKeyChain)
-    , subscriberFace(makeDummyClientFace(io))
-    , subscriber(*subscriberFace, streamPrefix, time::seconds(1))
+    , publisherFace(io)
+    , notificationStream(publisherFace, streamPrefix, publisherKeyChain)
+    , subscriberFace(io)
+    , subscriber(subscriberFace, streamPrefix, time::seconds(1))
   {
   }
 
@@ -56,18 +56,18 @@
   void
   deliverNotification(const std::string& msg)
   {
-    publisherFace->sentDatas.clear();
+    publisherFace.sentData.clear();
     SimpleNotification notification(msg);
     notificationStream.postNotification(notification);
 
     advanceClocks(time::milliseconds(1));
 
-    BOOST_REQUIRE_EQUAL(publisherFace->sentDatas.size(), 1);
+    BOOST_REQUIRE_EQUAL(publisherFace.sentData.size(), 1);
 
-    lastDeliveredSeqNo = publisherFace->sentDatas[0].getName().at(-1).toSequenceNumber();
+    lastDeliveredSeqNo = publisherFace.sentData[0].getName().at(-1).toSequenceNumber();
 
     lastNotification.setMessage("");
-    subscriberFace->receive(publisherFace->sentDatas[0]);
+    subscriberFace.receive(publisherFace.sentData[0]);
   }
 
   void
@@ -93,10 +93,10 @@
   bool
   hasInitialRequest() const
   {
-    if (subscriberFace->sentInterests.empty())
+    if (subscriberFace.sentInterests.empty())
       return 0;
 
-    const Interest& interest = subscriberFace->sentInterests[0];
+    const Interest& interest = subscriberFace.sentInterests[0];
     return interest.getName() == streamPrefix &&
            interest.getChildSelector() == 1 &&
            interest.getMustBeFresh() &&
@@ -109,10 +109,10 @@
   uint64_t
   getRequestSeqNo() const
   {
-    if (subscriberFace->sentInterests.size() != 1)
+    if (subscriberFace.sentInterests.size() != 1)
       return 0;
 
-    const Interest& interest = subscriberFace->sentInterests[0];
+    const Interest& interest = subscriberFace.sentInterests[0];
     const Name& name = interest.getName();
     if (streamPrefix.isPrefixOf(name) &&
         name.size() == streamPrefix.size() + 1 &&
@@ -124,10 +124,10 @@
 
 protected:
   Name streamPrefix;
-  shared_ptr<DummyClientFace> publisherFace;
+  DummyClientFace publisherFace;
   ndn::KeyChain publisherKeyChain;
   util::NotificationStream<SimpleNotification> notificationStream;
-  shared_ptr<DummyClientFace> subscriberFace;
+  DummyClientFace subscriberFace;
   util::NotificationSubscriber<SimpleNotification> subscriber;
   util::signal::Connection notificationConn;
 
@@ -155,30 +155,30 @@
   this->deliverNotification("n1");
   advanceClocks(time::milliseconds(1));
   BOOST_CHECK(lastNotification.getMessage().empty());
-  BOOST_CHECK_EQUAL(subscriberFace->sentInterests.size(), 0);
+  BOOST_CHECK_EQUAL(subscriberFace.sentInterests.size(), 0);
 
-  subscriberFace->sentInterests.clear();
+  subscriberFace.sentInterests.clear();
   subscriber.start();
   advanceClocks(time::milliseconds(1));
   BOOST_REQUIRE_EQUAL(subscriber.isRunning(), true);
   BOOST_CHECK(this->hasInitialRequest());
 
   // respond to initial request
-  subscriberFace->sentInterests.clear();
+  subscriberFace.sentInterests.clear();
   this->deliverNotification("n2");
   advanceClocks(time::milliseconds(1));
   BOOST_CHECK_EQUAL(lastNotification.getMessage(), "n2");
   BOOST_CHECK_EQUAL(this->getRequestSeqNo(), lastDeliveredSeqNo + 1);
 
   // respond to continuation request
-  subscriberFace->sentInterests.clear();
+  subscriberFace.sentInterests.clear();
   this->deliverNotification("n3");
   advanceClocks(time::milliseconds(1));
   BOOST_CHECK_EQUAL(lastNotification.getMessage(), "n3");
   BOOST_CHECK_EQUAL(this->getRequestSeqNo(), lastDeliveredSeqNo + 1);
 
   // timeout
-  subscriberFace->sentInterests.clear();
+  subscriberFace.sentInterests.clear();
   lastNotification.setMessage("");
   advanceClocks(subscriber.getInterestLifetime(), 2);
   BOOST_CHECK(lastNotification.getMessage().empty());
@@ -190,8 +190,8 @@
   wrongName.append("%07%07");
   Data wrongData(wrongName);
   publisherKeyChain.sign(wrongData);
-  subscriberFace->receive(wrongData);
-  subscriberFace->sentInterests.clear();
+  subscriberFace.receive(wrongData);
+  subscriberFace.sentInterests.clear();
   lastNotification.setMessage("");
   advanceClocks(time::milliseconds(1));
   BOOST_CHECK(lastNotification.getMessage().empty());
@@ -199,7 +199,7 @@
   BOOST_CHECK(this->hasInitialRequest());
 
   // decode error in payload
-  subscriberFace->sentInterests.clear();
+  subscriberFace.sentInterests.clear();
   lastNotification.setMessage("");
   this->deliverNotification("\x07n4");
   advanceClocks(time::milliseconds(1));
@@ -208,10 +208,10 @@
 
   // stop if handlers are cleared
   notificationConn.disconnect();
-  subscriberFace->sentInterests.clear();
+  subscriberFace.sentInterests.clear();
   this->deliverNotification("n5");
   advanceClocks(time::milliseconds(1));
-  BOOST_CHECK_EQUAL(subscriberFace->sentInterests.size(), 0);
+  BOOST_CHECK_EQUAL(subscriberFace.sentInterests.size(), 0);
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/unit-tests/util/segment-fetcher.t.cpp b/tests/unit-tests/util/segment-fetcher.t.cpp
index e53cc0f..4cccc80 100644
--- a/tests/unit-tests/util/segment-fetcher.t.cpp
+++ b/tests/unit-tests/util/segment-fetcher.t.cpp
@@ -66,7 +66,7 @@
 {
 public:
   Fixture()
-    : face(makeDummyClientFace(io))
+    : face(io)
     , nErrors(0)
     , nDatas(0)
     , dataSize(0)
@@ -107,14 +107,14 @@
   void
   nackLastInterest(lp::NackReason nackReason)
   {
-    const Interest& lastInterest = face->sentInterests.back();
+    const Interest& lastInterest = face.sentInterests.back();
     lp::Nack nack = makeNack(lastInterest, nackReason);
-    face->receive(nack);
+    face.receive(nack);
     advanceClocks(time::milliseconds(1), 10);
   }
 
 public:
-  shared_ptr<DummyClientFace> face;
+  DummyClientFace face;
   KeyChain keyChain;
 
   uint32_t nErrors;
@@ -127,7 +127,7 @@
 BOOST_FIXTURE_TEST_CASE(Timeout, Fixture)
 {
   ValidatorNull nullValidator;
-  SegmentFetcher::fetch(*face, Interest("/hello/world", time::milliseconds(100)),
+  SegmentFetcher::fetch(face, Interest("/hello/world", time::milliseconds(100)),
                         nullValidator,
                         bind(&Fixture::onComplete, this, _1),
                         bind(&Fixture::onError, this, _1));
@@ -136,10 +136,10 @@
 
   BOOST_CHECK_EQUAL(nErrors, 0);
   BOOST_CHECK_EQUAL(nDatas, 0);
-  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
-  BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
+  BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face.sentData.size(), 0);
 
-  const Interest& interest = face->sentInterests[0];
+  const Interest& interest = face.sentInterests[0];
   BOOST_CHECK_EQUAL(interest.getName(), "/hello/world");
   BOOST_CHECK_EQUAL(interest.getMustBeFresh(), true);
   BOOST_CHECK_EQUAL(interest.getChildSelector(), 1);
@@ -148,22 +148,22 @@
 
   BOOST_CHECK_EQUAL(nErrors, 1);
   BOOST_CHECK_EQUAL(lastError, static_cast<uint32_t>(SegmentFetcher::INTEREST_TIMEOUT));
-  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
-  BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
+  BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face.sentData.size(), 0);
 }
 
 
 BOOST_FIXTURE_TEST_CASE(Basic, Fixture)
 {
   ValidatorNull nullValidator;
-  SegmentFetcher::fetch(*face, Interest("/hello/world", time::seconds(1000)),
+  SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
                         nullValidator,
                         bind(&Fixture::onComplete, this, _1),
                         bind(&Fixture::onError, this, _1));
 
   advanceClocks(time::milliseconds(1), 10);
 
-  face->receive(*makeDataSegment("/hello/world/version0", 0, true));
+  face.receive(*makeDataSegment("/hello/world/version0", 0, true));
   advanceClocks(time::milliseconds(1), 10);
 
   BOOST_CHECK_EQUAL(nErrors, 0);
@@ -176,10 +176,10 @@
 
   BOOST_CHECK_EQUAL(dataString, bufferString);
 
-  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
-  BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
+  BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face.sentData.size(), 0);
 
-  const Interest& interest = face->sentInterests[0];
+  const Interest& interest = face.sentInterests[0];
   BOOST_CHECK_EQUAL(interest.getName(), "/hello/world");
   BOOST_CHECK_EQUAL(interest.getMustBeFresh(), true);
   BOOST_CHECK_EQUAL(interest.getChildSelector(), 1);
@@ -188,7 +188,7 @@
 BOOST_FIXTURE_TEST_CASE(NoSegmentInData, Fixture)
 {
   ValidatorNull nullValidator;
-  SegmentFetcher::fetch(*face, Interest("/hello/world", time::seconds(1000)),
+  SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
                         nullValidator,
                         bind(&Fixture::onComplete, this, _1),
                         bind(&Fixture::onError, this, _1));
@@ -201,7 +201,7 @@
 
   data->setContent(buffer, sizeof(buffer));
 
-  face->receive(*data);
+  face.receive(*data);
   advanceClocks(time::milliseconds(1), 10);
 
   BOOST_CHECK_EQUAL(nErrors, 1);
@@ -212,13 +212,13 @@
 BOOST_FIXTURE_TEST_CASE(SegmentValidationFailure, Fixture)
 {
   ValidatorFailed failedValidator;
-  SegmentFetcher::fetch(*face, Interest("/hello/world", time::seconds(1000)),
+  SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
                         failedValidator,
                         bind(&Fixture::onComplete, this, _1),
                         bind(&Fixture::onError, this, _1));
 
   advanceClocks(time::milliseconds(1), 10);
-  face->receive(*makeDataSegment("/hello/world/version0", 0, true));
+  face.receive(*makeDataSegment("/hello/world/version0", 0, true));
   advanceClocks(time::milliseconds(1), 10);
 
   BOOST_CHECK_EQUAL(nErrors, 1);
@@ -229,19 +229,19 @@
 BOOST_FIXTURE_TEST_CASE(Triple, Fixture)
 {
   ValidatorNull nullValidator;
-  SegmentFetcher::fetch(*face, Interest("/hello/world", time::seconds(1000)),
+  SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
                         nullValidator,
                         bind(&Fixture::onComplete, this, _1),
                         bind(&Fixture::onError, this, _1));
 
   advanceClocks(time::milliseconds(1), 10);
-  face->receive(*makeDataSegment("/hello/world/version0", 0, false));
+  face.receive(*makeDataSegment("/hello/world/version0", 0, false));
 
   advanceClocks(time::milliseconds(1), 10);
-  face->receive(*makeDataSegment("/hello/world/version0", 1, false));
+  face.receive(*makeDataSegment("/hello/world/version0", 1, false));
 
   advanceClocks(time::milliseconds(1), 10);
-  face->receive(*makeDataSegment("/hello/world/version0", 2, true));
+  face.receive(*makeDataSegment("/hello/world/version0", 2, true));
 
   advanceClocks(time::milliseconds(1), 10);
 
@@ -250,25 +250,25 @@
 
   BOOST_CHECK_EQUAL(dataSize, 42);
 
-  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 3);
-  BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
+  BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 3);
+  BOOST_CHECK_EQUAL(face.sentData.size(), 0);
 
   {
-    const Interest& interest = face->sentInterests[0];
+    const Interest& interest = face.sentInterests[0];
     BOOST_CHECK_EQUAL(interest.getName(), "/hello/world");
     BOOST_CHECK_EQUAL(interest.getMustBeFresh(), true);
     BOOST_CHECK_EQUAL(interest.getChildSelector(), 1);
   }
 
   {
-    const Interest& interest = face->sentInterests[1];
+    const Interest& interest = face.sentInterests[1];
     BOOST_CHECK_EQUAL(interest.getName(), "/hello/world/version0/%00%01");
     BOOST_CHECK_EQUAL(interest.getMustBeFresh(), false);
     BOOST_CHECK_EQUAL(interest.getChildSelector(), 0);
   }
 
   {
-    const Interest& interest = face->sentInterests[2];
+    const Interest& interest = face.sentInterests[2];
     BOOST_CHECK_EQUAL(interest.getName(),  "/hello/world/version0/%00%02");
     BOOST_CHECK_EQUAL(interest.getMustBeFresh(), false);
     BOOST_CHECK_EQUAL(interest.getChildSelector(), 0);
@@ -278,22 +278,22 @@
 BOOST_FIXTURE_TEST_CASE(TripleWithInitialSegmentFetching, Fixture)
 {
   ValidatorNull nullValidator;
-  SegmentFetcher::fetch(*face, Interest("/hello/world", time::seconds(1000)),
+  SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
                         nullValidator,
                         bind(&Fixture::onComplete, this, _1),
                         bind(&Fixture::onError, this, _1));
 
   advanceClocks(time::milliseconds(1), 10);
-  face->receive(*makeDataSegment("/hello/world/version0", 1, false));
+  face.receive(*makeDataSegment("/hello/world/version0", 1, false));
 
   advanceClocks(time::milliseconds(1), 10);
-  face->receive(*makeDataSegment("/hello/world/version0", 0, false));
+  face.receive(*makeDataSegment("/hello/world/version0", 0, false));
 
   advanceClocks(time::milliseconds(1), 10);
-  face->receive(*makeDataSegment("/hello/world/version0", 1, false));
+  face.receive(*makeDataSegment("/hello/world/version0", 1, false));
 
   advanceClocks(time::milliseconds(1), 10);
-  face->receive(*makeDataSegment("/hello/world/version0", 2, true));
+  face.receive(*makeDataSegment("/hello/world/version0", 2, true));
 
   advanceClocks(time::milliseconds(1), 10);
 
@@ -302,32 +302,32 @@
 
   BOOST_CHECK_EQUAL(dataSize, 42);
 
-  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 4);
-  BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
+  BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 4);
+  BOOST_CHECK_EQUAL(face.sentData.size(), 0);
 
   {
-    const Interest& interest = face->sentInterests[0];
+    const Interest& interest = face.sentInterests[0];
     BOOST_CHECK_EQUAL(interest.getName(), "/hello/world");
     BOOST_CHECK_EQUAL(interest.getMustBeFresh(), true);
     BOOST_CHECK_EQUAL(interest.getChildSelector(), 1);
   }
 
   {
-    const Interest& interest = face->sentInterests[1];
+    const Interest& interest = face.sentInterests[1];
     BOOST_CHECK_EQUAL(interest.getName(), "/hello/world/version0/%00%00");
     BOOST_CHECK_EQUAL(interest.getMustBeFresh(), false);
     BOOST_CHECK_EQUAL(interest.getChildSelector(), 0);
   }
 
   {
-    const Interest& interest = face->sentInterests[2];
+    const Interest& interest = face.sentInterests[2];
     BOOST_CHECK_EQUAL(interest.getName(), "/hello/world/version0/%00%01");
     BOOST_CHECK_EQUAL(interest.getMustBeFresh(), false);
     BOOST_CHECK_EQUAL(interest.getChildSelector(), 0);
   }
 
   {
-    const Interest& interest = face->sentInterests[3];
+    const Interest& interest = face.sentInterests[3];
     BOOST_CHECK_EQUAL(interest.getName(),  "/hello/world/version0/%00%02");
     BOOST_CHECK_EQUAL(interest.getMustBeFresh(), false);
     BOOST_CHECK_EQUAL(interest.getChildSelector(), 0);
@@ -337,7 +337,7 @@
 BOOST_FIXTURE_TEST_CASE(MultipleSegmentFetching, Fixture)
 {
   ValidatorNull nullValidator;
-  SegmentFetcher::fetch(*face, Interest("/hello/world", time::seconds(1000)),
+  SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
                         nullValidator,
                         bind(&Fixture::onComplete, this, _1),
                         bind(&Fixture::onError, this, _1));
@@ -346,10 +346,10 @@
 
   for (uint64_t i = 0; i < 400; i++) {
     advanceClocks(time::milliseconds(1), 10);
-    face->receive(*makeDataSegment("/hello/world/version0", i, false));
+    face.receive(*makeDataSegment("/hello/world/version0", i, false));
   }
   advanceClocks(time::milliseconds(1), 10);
-  face->receive(*makeDataSegment("/hello/world/version0", 400, true));
+  face.receive(*makeDataSegment("/hello/world/version0", 400, true));
 
   advanceClocks(time::milliseconds(1), 10);
 
@@ -359,7 +359,7 @@
 
 BOOST_FIXTURE_TEST_CASE(SegmentFetcherDuplicateNack, Fixture)
 {
-  SegmentFetcher::fetch(*face, Interest("/hello/world", time::seconds(1000)),
+  SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
                         make_shared<ValidatorNull>(),
                         bind(&Fixture::onComplete, this, _1),
                         bind(&Fixture::onError, this, _1));
@@ -373,13 +373,13 @@
     nackLastInterest(lp::NackReason::DUPLICATE);
   }
 
-  BOOST_CHECK_EQUAL(face->sentInterests.size(), (SegmentFetcher::MAX_INTEREST_REEXPRESS + 1));
+  BOOST_CHECK_EQUAL(face.sentInterests.size(), (SegmentFetcher::MAX_INTEREST_REEXPRESS + 1));
   BOOST_CHECK_EQUAL(lastError, static_cast<uint32_t>(SegmentFetcher::NACK_ERROR));
 }
 
 BOOST_FIXTURE_TEST_CASE(SegmentFetcherCongestionNack, Fixture)
 {
-  SegmentFetcher::fetch(*face, Interest("/hello/world", time::seconds(1000)),
+  SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
                         make_shared<ValidatorNull>(),
                         bind(&Fixture::onComplete, this, _1),
                         bind(&Fixture::onError, this, _1));
@@ -393,7 +393,7 @@
     nackLastInterest(lp::NackReason::CONGESTION);
   }
 
-  BOOST_CHECK_EQUAL(face->sentInterests.size(), (SegmentFetcher::MAX_INTEREST_REEXPRESS + 1));
+  BOOST_CHECK_EQUAL(face.sentInterests.size(), (SegmentFetcher::MAX_INTEREST_REEXPRESS + 1));
   BOOST_CHECK_EQUAL(lastError, static_cast<uint32_t>(SegmentFetcher::NACK_ERROR));
 }
 
