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