diff --git a/tests/pib/cert-publicher.t.cpp b/tests/pib/cert-publicher.t.cpp
index a14731c..ca71e4c 100644
--- a/tests/pib/cert-publicher.t.cpp
+++ b/tests/pib/cert-publicher.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2015,  Regents of the University of California.
+ * Copyright (c) 2014-2016,  Regents of the University of California.
  *
  * This file is part of ndn-tools (Named Data Networking Essential Tools).
  * See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -37,7 +37,7 @@
   CertPublisherFixture()
     : tmpPath(boost::filesystem::path(TMP_TESTS_PATH) / "DbTest")
     , db(tmpPath.c_str())
-    , face(util::makeDummyClientFace(io, {true, true}))
+    , face(io, m_keyChain, {true, true})
   {
   }
 
@@ -49,7 +49,7 @@
   boost::asio::io_service io;
   boost::filesystem::path tmpPath;
   PibDb db;
-  shared_ptr<util::DummyClientFace> face;
+  util::DummyClientFace face;
 };
 
 BOOST_FIXTURE_TEST_SUITE(PibCertPublisher, CertPublisherFixture)
@@ -67,62 +67,62 @@
   shared_ptr<IdentityCertificate> cert112 = m_keyChain.selfSign(keyName11);
   Name certName112 = cert112->getName();
 
-  CertPublisher certPublisher(*face, db);
+  CertPublisher certPublisher(face, db);
 
   // Add a certificate
   db.addCertificate(*cert111);
   advanceClocks(io, time::milliseconds(2), 50);
 
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 0);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 0);
   auto interest111 = make_shared<Interest>(cert111->getName().getPrefix(-1));
-  face->receive(*interest111);
+  face.receive(*interest111);
   advanceClocks(io, time::milliseconds(2), 50);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
-  BOOST_CHECK(face->sentDatas[0].wireEncode() == cert111->wireEncode());
-  face->sentDatas.clear();
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+  BOOST_CHECK(face.sentData[0].wireEncode() == cert111->wireEncode());
+  face.sentData.clear();
 
   // Add another certificate
   db.addCertificate(*cert112);
   advanceClocks(io, time::milliseconds(2), 50);
 
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 0);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 0);
   auto interest112 = make_shared<Interest>(cert112->getName().getPrefix(-1));
-  face->receive(*interest112);
+  face.receive(*interest112);
   advanceClocks(io, time::milliseconds(2), 50);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
-  BOOST_CHECK(face->sentDatas[0].wireEncode() == cert111->wireEncode());
-  face->sentDatas.clear();
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+  BOOST_CHECK(face.sentData[0].wireEncode() == cert111->wireEncode());
+  face.sentData.clear();
 
   Exclude exclude;
   exclude.excludeOne(cert111->getName().get(-1));
   interest112->setExclude(exclude);
-  face->receive(*interest112);
+  face.receive(*interest112);
   advanceClocks(io, time::milliseconds(2), 50);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
-  BOOST_CHECK(face->sentDatas[0].wireEncode() == cert112->wireEncode());
-  face->sentDatas.clear();
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+  BOOST_CHECK(face.sentData[0].wireEncode() == cert112->wireEncode());
+  face.sentData.clear();
 
   // delete a certificate
   db.deleteCertificate(certName112);
-  face->receive(*interest112);
+  face.receive(*interest112);
   advanceClocks(io, time::milliseconds(2), 50);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 0);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 0);
 
-  face->receive(*interest111);
+  face.receive(*interest111);
   advanceClocks(io, time::milliseconds(2), 50);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
-  BOOST_CHECK(face->sentDatas[0].wireEncode() == cert111->wireEncode());
-  face->sentDatas.clear();
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+  BOOST_CHECK(face.sentData[0].wireEncode() == cert111->wireEncode());
+  face.sentData.clear();
 
   // delete another certificate
   db.deleteCertificate(certName111);
-  face->receive(*interest112);
+  face.receive(*interest112);
   advanceClocks(io, time::milliseconds(2), 50);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 0);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 0);
 
-  face->receive(*interest111);
+  face.receive(*interest111);
   advanceClocks(io, time::milliseconds(2), 50);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 0);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 0);
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/pib/pib.t.cpp b/tests/pib/pib.t.cpp
index 0bbeca9..f797d3c 100644
--- a/tests/pib/pib.t.cpp
+++ b/tests/pib/pib.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2015,  Regents of the University of California.
+ * Copyright (c) 2014-2016,  Regents of the University of California.
  *
  * This file is part of ndn-tools (Named Data Networking Essential Tools).
  * See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -39,7 +39,7 @@
 public:
   PibTestFixture()
     : tmpPath(boost::filesystem::path(TMP_TESTS_PATH) / "PibTest")
-    , face(util::makeDummyClientFace(io, {true, true}))
+    , face(io, m_keyChain, {true, true})
   {
   }
 
@@ -72,7 +72,7 @@
   boost::asio::io_service io;
   std::string owner;
   boost::filesystem::path tmpPath;
-  shared_ptr<util::DummyClientFace> face;
+  util::DummyClientFace face;
 };
 
 BOOST_FIXTURE_TEST_SUITE(PibPib, PibTestFixture)
@@ -82,7 +82,7 @@
   // Create a PIB with full parameters
   owner = "testUser";
 
-  Pib pib(*face,
+  Pib pib(face,
           tmpPath.string(),
           m_keyChain.getTpm().getTpmLocator(),
           owner);
@@ -105,12 +105,12 @@
   GetParam param01;
   shared_ptr<Interest> interest01 = generateUnsignedInterest(param01, owner);
 
-  face->receive(*interest01);
+  face.receive(*interest01);
   advanceClocks(io, time::milliseconds(10), 10);
 
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibUser result01;
-  BOOST_REQUIRE_NO_THROW(result01.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result01.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK(result01.getMgmtCert().wireEncode() == mgmtCert.wireEncode());
   BOOST_CHECK_EQUAL(result01.getTpmLocator(), m_keyChain.getTpm().getTpmLocator());
 }
@@ -129,19 +129,19 @@
   shared_ptr<IdentityCertificate> testUserCert = m_keyChain.getCertificate(testUserCertName);
 
   PibDb db(tmpPath.string());
-  BOOST_CHECK_NO_THROW(Pib(*face, dbDir, tpmLocator, owner));
+  BOOST_CHECK_NO_THROW(Pib(face, dbDir, tpmLocator, owner));
 
   db.updateMgmtCertificate(*testUserCert);
-  BOOST_CHECK_NO_THROW(Pib(*face, dbDir, tpmLocator, owner));
-  BOOST_CHECK_THROW(Pib(*face, dbDir, tpmLocator, "wrongUser"), Pib::Error);
+  BOOST_CHECK_NO_THROW(Pib(face, dbDir, tpmLocator, owner));
+  BOOST_CHECK_THROW(Pib(face, dbDir, tpmLocator, "wrongUser"), Pib::Error);
 
   db.setTpmLocator(m_keyChain.getTpm().getTpmLocator());
-  BOOST_CHECK_NO_THROW(Pib(*face, dbDir, tpmLocator, owner));
-  BOOST_CHECK_THROW(Pib(*face, dbDir, "tpm-file:wrong", owner), Pib::Error);
+  BOOST_CHECK_NO_THROW(Pib(face, dbDir, tpmLocator, owner));
+  BOOST_CHECK_THROW(Pib(face, dbDir, "tpm-file:wrong", owner), Pib::Error);
 
   advanceClocks(io, time::milliseconds(10));
   m_keyChain.deleteIdentity(testUser);
-  BOOST_CHECK_NO_THROW(Pib(*face, dbDir, tpmLocator, owner));
+  BOOST_CHECK_NO_THROW(Pib(face, dbDir, tpmLocator, owner));
 }
 
 BOOST_AUTO_TEST_CASE(InitCertTest3)
@@ -155,18 +155,18 @@
   Name testUserCertName = m_keyChain.getDefaultCertificateNameForIdentity(testUser);
   shared_ptr<IdentityCertificate> testUserCert = m_keyChain.getCertificate(testUserCertName);
 
-  Pib pib1(*face, dbDir, tpmLocator, owner);
+  Pib pib1(face, dbDir, tpmLocator, owner);
   BOOST_CHECK_EQUAL(pib1.getMgmtCert().getName().getPrefix(-3),
                     Name("/localhost/pib/testUser/mgmt/KEY"));
 
   PibDb db(tmpPath.string());
   db.updateMgmtCertificate(*testUserCert);
-  Pib pib2(*face, dbDir, tpmLocator, owner);
+  Pib pib2(face, dbDir, tpmLocator, owner);
   BOOST_CHECK_EQUAL(pib2.getMgmtCert().getName(), testUserCertName);
 
   advanceClocks(io, time::milliseconds(10));
   m_keyChain.deleteIdentity(testUser);
-  Pib pib3(*face, dbDir, tpmLocator, owner);
+  Pib pib3(face, dbDir, tpmLocator, owner);
   BOOST_CHECK(pib3.getMgmtCert().getName() != testUserCertName);
   BOOST_CHECK_EQUAL(pib3.getMgmtCert().getName().getPrefix(-3),
                     Name("/localhost/pib/testUser/mgmt/KEY"));
@@ -176,7 +176,7 @@
 {
   owner = "alice";
 
-  Pib pib(*face,
+  Pib pib(face,
           tmpPath.string(),
           m_keyChain.getTpm().getTpmLocator(),
           owner);
@@ -231,39 +231,39 @@
   GetParam param01;
   shared_ptr<Interest> interest01 = generateUnsignedInterest(param01, owner);
 
-  face->sentDatas.clear();
-  face->receive(*interest01);
+  face.sentData.clear();
+  face.receive(*interest01);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_REQUIRE(cache.find(interest01->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibUser result01;
-  BOOST_REQUIRE_NO_THROW(result01.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result01.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK(result01.getMgmtCert().wireEncode() == ownerMgmtCert.wireEncode());
 
 
   GetParam param02;
   shared_ptr<Interest> interest02 = generateUnsignedInterest(param02, "non-existing");
 
-  face->sentDatas.clear();
-  face->receive(*interest02);
+  face.sentData.clear();
+  face.receive(*interest02);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_CHECK(cache.find(interest02->getName()) == nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 0);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 0);
 
 
   GetParam param03(TYPE_ID, testId);
   shared_ptr<Interest> interest03 = generateUnsignedInterest(param03, owner);
 
-  face->sentDatas.clear();
-  face->receive(*interest03);
+  face.sentData.clear();
+  face.receive(*interest03);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_REQUIRE(cache.find(interest03->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibIdentity result03;
-  BOOST_REQUIRE_NO_THROW(result03.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result03.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result03.getIdentity(), testId);
 
 
@@ -271,28 +271,28 @@
   GetParam param04(TYPE_ID, wrongId);
   shared_ptr<Interest> interest04 = generateUnsignedInterest(param04, owner);
 
-  face->sentDatas.clear();
-  face->receive(*interest04);
+  face.sentData.clear();
+  face.receive(*interest04);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_REQUIRE(cache.find(interest04->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibError result04;
-  BOOST_REQUIRE_NO_THROW(result04.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result04.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result04.getErrorCode(), ERR_NON_EXISTING_ID);
 
 
   GetParam param05(TYPE_KEY, testIdKeyName1);
   shared_ptr<Interest> interest05 = generateUnsignedInterest(param05, owner);
 
-  face->sentDatas.clear();
-  face->receive(*interest05);
+  face.sentData.clear();
+  face.receive(*interest05);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_REQUIRE(cache.find(interest05->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibPublicKey result05;
-  BOOST_REQUIRE_NO_THROW(result05.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result05.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result05.getKeyName(), testIdKeyName1);
 
 
@@ -300,28 +300,28 @@
   GetParam param06(TYPE_KEY, wrongKeyName1);
   shared_ptr<Interest> interest06 = generateUnsignedInterest(param06, owner);
 
-  face->sentDatas.clear();
-  face->receive(*interest06);
+  face.sentData.clear();
+  face.receive(*interest06);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_REQUIRE(cache.find(interest06->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibError result06;
-  BOOST_REQUIRE_NO_THROW(result06.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result06.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result06.getErrorCode(), ERR_NON_EXISTING_KEY);
 
 
   GetParam param07(TYPE_CERT, testIdCertName00);
   shared_ptr<Interest> interest07 = generateUnsignedInterest(param07, owner);
 
-  face->sentDatas.clear();
-  face->receive(*interest07);
+  face.sentData.clear();
+  face.receive(*interest07);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_REQUIRE(cache.find(interest07->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibCertificate result07;
-  BOOST_REQUIRE_NO_THROW(result07.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result07.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result07.getCertificate().getName(), testIdCertName00);
 
 
@@ -329,14 +329,14 @@
   GetParam param08(TYPE_CERT, wrongCertName1);
   shared_ptr<Interest> interest08 = generateUnsignedInterest(param08, owner);
 
-  face->sentDatas.clear();
-  face->receive(*interest08);
+  face.sentData.clear();
+  face.receive(*interest08);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_REQUIRE(cache.find(interest08->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibError result08;
-  BOOST_REQUIRE_NO_THROW(result08.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result08.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result08.getErrorCode(), ERR_NON_EXISTING_CERT);
 
 
@@ -344,14 +344,14 @@
   GetParam param09(TYPE_KEY, wrongKeyName2);
   shared_ptr<Interest> interest09 = generateUnsignedInterest(param09, owner);
 
-  face->sentDatas.clear();
-  face->receive(*interest09);
+  face.sentData.clear();
+  face.receive(*interest09);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_REQUIRE(cache.find(interest09->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibError result09;
-  BOOST_REQUIRE_NO_THROW(result09.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result09.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result09.getErrorCode(), ERR_WRONG_PARAM);
 }
 
@@ -359,7 +359,7 @@
 {
   owner = "alice";
 
-  Pib pib(*face,
+  Pib pib(face,
           tmpPath.string(),
           m_keyChain.getTpm().getTpmLocator(),
           owner);
@@ -414,84 +414,84 @@
   DefaultParam param11(TYPE_ID, TYPE_USER);
   shared_ptr<Interest> interest11 = generateUnsignedInterest(param11, owner);
 
-  face->sentDatas.clear();
-  face->receive(*interest11);
+  face.sentData.clear();
+  face.receive(*interest11);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_REQUIRE(cache.find(interest11->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibIdentity result11;
-  BOOST_REQUIRE_NO_THROW(result11.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result11.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result11.getIdentity(), testId);
 
 
   DefaultParam param13(TYPE_ID, TYPE_ID);
   shared_ptr<Interest> interest13 = generateUnsignedInterest(param13, owner);
 
-  face->sentDatas.clear();
-  face->receive(*interest13);
+  face.sentData.clear();
+  face.receive(*interest13);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_REQUIRE(cache.find(interest13->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibError result13;
-  BOOST_REQUIRE_NO_THROW(result13.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result13.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result13.getErrorCode(), ERR_WRONG_PARAM);
 
 
   DefaultParam param14(TYPE_KEY, TYPE_ID, testId);
   shared_ptr<Interest> interest14 = generateUnsignedInterest(param14, owner);
 
-  face->sentDatas.clear();
-  face->receive(*interest14);
+  face.sentData.clear();
+  face.receive(*interest14);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_REQUIRE(cache.find(interest14->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibPublicKey result14;
-  BOOST_REQUIRE_NO_THROW(result14.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result14.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result14.getKeyName(), testIdKeyName0);
 
 
   DefaultParam param15(TYPE_CERT, TYPE_ID, testId);
   shared_ptr<Interest> interest15 = generateUnsignedInterest(param15, owner);
 
-  face->sentDatas.clear();
-  face->receive(*interest15);
+  face.sentData.clear();
+  face.receive(*interest15);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_REQUIRE(cache.find(interest15->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibCertificate result15;
-  BOOST_REQUIRE_NO_THROW(result15.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result15.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result15.getCertificate().getName(), testIdCertName00);
 
 
   DefaultParam param16(TYPE_CERT, TYPE_USER);
   shared_ptr<Interest> interest16 = generateUnsignedInterest(param16, owner);
 
-  face->sentDatas.clear();
-  face->receive(*interest16);
+  face.sentData.clear();
+  face.receive(*interest16);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_REQUIRE(cache.find(interest16->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibCertificate result16;
-  BOOST_REQUIRE_NO_THROW(result16.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result16.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result16.getCertificate().getName(), testIdCertName00);
 
 
   DefaultParam param17(TYPE_CERT, TYPE_KEY, testIdKeyName1);
   shared_ptr<Interest> interest17 = generateUnsignedInterest(param17, owner);
 
-  face->sentDatas.clear();
-  face->receive(*interest17);
+  face.sentData.clear();
+  face.receive(*interest17);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_REQUIRE(cache.find(interest17->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibCertificate result17;
-  BOOST_REQUIRE_NO_THROW(result17.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result17.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result17.getCertificate().getName(), testIdCertName10);
 }
 
@@ -499,7 +499,7 @@
 {
   owner = "alice";
 
-  Pib pib(*face,
+  Pib pib(face,
           tmpPath.string(),
           m_keyChain.getTpm().getTpmLocator(),
           owner);
@@ -556,42 +556,42 @@
   ListParam param21;
   shared_ptr<Interest> interest21 = generateUnsignedInterest(param21, owner);
 
-  face->sentDatas.clear();
-  face->receive(*interest21);
+  face.sentData.clear();
+  face.receive(*interest21);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_REQUIRE(cache.find(interest21->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibNameList result21;
-  BOOST_REQUIRE_NO_THROW(result21.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result21.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result21.getNameList().size(), 1);
 
 
   ListParam param22(TYPE_ID, testId);
   shared_ptr<Interest> interest22 = generateUnsignedInterest(param22, owner);
 
-  face->sentDatas.clear();
-  face->receive(*interest22);
+  face.sentData.clear();
+  face.receive(*interest22);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_REQUIRE(cache.find(interest22->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibNameList result22;
-  BOOST_REQUIRE_NO_THROW(result22.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result22.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result22.getNameList().size(), 2);
 
 
   ListParam param23(TYPE_ID, wrongId);
   shared_ptr<Interest> interest23 = generateUnsignedInterest(param23, owner);
 
-  face->sentDatas.clear();
-  face->receive(*interest23);
+  face.sentData.clear();
+  face.receive(*interest23);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_REQUIRE(cache.find(interest23->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibNameList result23;
-  BOOST_REQUIRE_NO_THROW(result23.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result23.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result23.getNameList().size(), 0);
 }
 
@@ -600,7 +600,7 @@
   // This test case is to check the access control of local management key
   owner = "alice";
 
-  Pib pib(*face,
+  Pib pib(face,
           tmpPath.string(),
           m_keyChain.getTpm().getTpmLocator(),
           owner);
@@ -639,7 +639,7 @@
 
   owner = "alice";
 
-  Pib pib(*face,
+  Pib pib(face,
           tmpPath.string(),
           m_keyChain.getTpm().getTpmLocator(),
           owner);
@@ -776,7 +776,7 @@
 
   owner = "alice";
 
-  Pib pib(*face,
+  Pib pib(face,
           tmpPath.string(),
           m_keyChain.getTpm().getTpmLocator(),
           owner);
@@ -814,7 +814,7 @@
   // This test case is to check the access control of regular key
   owner = "alice";
 
-  Pib pib(*face,
+  Pib pib(face,
           tmpPath.string(),
           m_keyChain.getTpm().getTpmLocator(),
           owner);
@@ -908,7 +908,7 @@
 {
   owner = "alice";
 
-  Pib pib(*face,
+  Pib pib(face,
           tmpPath.string(),
           m_keyChain.getTpm().getTpmLocator(),
           owner);
@@ -931,14 +931,14 @@
   UpdateParam param1(pibUser1);
   auto interest1 = generateSignedInterest(param1, owner, db.getMgmtCertificate()->getName());
 
-  face->sentDatas.clear();
-  face->receive(*interest1);
+  face.sentData.clear();
+  face.receive(*interest1);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_REQUIRE(cache.find(interest1->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibError result;
-  BOOST_REQUIRE_NO_THROW(result.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result.getErrorCode(), ERR_WRONG_PARAM);
 
   // user name is correct, but signer is wrong, should fail
@@ -947,12 +947,12 @@
   UpdateParam param2(pibUser2);
   auto interest2 = generateSignedInterest(param2, owner, bobCertName);
 
-  face->sentDatas.clear();
-  face->receive(*interest2);
+  face.sentData.clear();
+  face.receive(*interest2);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_CHECK(cache.find(interest2->getName()) == nullptr); // verification should fail, no response
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 0);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 0);
 
   // update an existing user with a new mgmt key, signed by the old mgmt key.
   advanceClocks(io, time::milliseconds(100));
@@ -966,14 +966,14 @@
   UpdateParam param3(pibUser3);
   auto interest3 = generateSignedInterest(param3, owner, db.getMgmtCertificate()->getName());
 
-  face->sentDatas.clear();
-  face->receive(*interest3);
+  face.sentData.clear();
+  face.receive(*interest3);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_REQUIRE(cache.find(interest3->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibError result3;
-  BOOST_REQUIRE_NO_THROW(result3.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result3.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result3.getErrorCode(), ERR_SUCCESS);
   BOOST_CHECK(db.getMgmtCertificate()->wireEncode() == ownerSecondCert->wireEncode());
 
@@ -985,14 +985,14 @@
   UpdateParam updateParam(*testIdCert, DEFAULT_OPT_USER);
   auto interest4 = generateSignedInterest(updateParam, owner, ownerSecondCert->getName());
 
-  face->sentDatas.clear();
-  face->receive(*interest4);
+  face.sentData.clear();
+  face.receive(*interest4);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_REQUIRE(cache.find(interest4->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibError result4;
-  BOOST_REQUIRE_NO_THROW(result4.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result4.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result4.getErrorCode(), ERR_SUCCESS);
 
   BOOST_CHECK(pib.getDb().hasCertificate(testIdCertName));
@@ -1012,7 +1012,7 @@
 {
   owner = "alice";
 
-  Pib pib(*face,
+  Pib pib(face,
           tmpPath.string(),
           m_keyChain.getTpm().getTpmLocator(),
           owner);
@@ -1067,14 +1067,14 @@
   UpdateParam param1(*cert000);
   auto interest1 = generateSignedInterest(param1, owner, ownerMgmtCert.getName());
 
-  face->sentDatas.clear();
-  face->receive(*interest1);
+  face.sentData.clear();
+  face.receive(*interest1);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_CHECK(cache.find(interest1->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibError result1;
-  BOOST_REQUIRE_NO_THROW(result1.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result1.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result1.getErrorCode(), ERR_SUCCESS);
   BOOST_CHECK_EQUAL(db.hasIdentity(id0), true);
   BOOST_CHECK_EQUAL(db.hasKey(keyName00), true);
@@ -1093,14 +1093,14 @@
   UpdateParam param2(id1, DEFAULT_OPT_USER);
   auto interest2 = generateSignedInterest(param2, owner, ownerMgmtCert.getName());
 
-  face->sentDatas.clear();
-  face->receive(*interest2);
+  face.sentData.clear();
+  face.receive(*interest2);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_CHECK(cache.find(interest2->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibError result2;
-  BOOST_REQUIRE_NO_THROW(result2.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result2.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result2.getErrorCode(), ERR_SUCCESS);
   BOOST_CHECK_EQUAL(db.getDefaultIdentity(), id1);
 
@@ -1108,14 +1108,14 @@
   UpdateParam param3(keyName01, cert010->getPublicKeyInfo(), DEFAULT_OPT_ID);
   auto interest3 = generateSignedInterest(param3, owner, ownerMgmtCert.getName());
 
-  face->sentDatas.clear();
-  face->receive(*interest3);
+  face.sentData.clear();
+  face.receive(*interest3);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_CHECK(cache.find(interest3->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibError result3;
-  BOOST_REQUIRE_NO_THROW(result3.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result3.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result3.getErrorCode(), ERR_SUCCESS);
   BOOST_CHECK_EQUAL(db.getDefaultKeyNameOfIdentity(id0), keyName01);
 
@@ -1123,14 +1123,14 @@
   UpdateParam param4(*cert011, DEFAULT_OPT_KEY);
   auto interest4 = generateSignedInterest(param4, owner, ownerMgmtCert.getName());
 
-  face->sentDatas.clear();
-  face->receive(*interest4);
+  face.sentData.clear();
+  face.receive(*interest4);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_CHECK(cache.find(interest4->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibError result4;
-  BOOST_REQUIRE_NO_THROW(result4.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result4.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result4.getErrorCode(), ERR_SUCCESS);
   BOOST_CHECK_EQUAL(db.getDefaultCertNameOfKey(keyName01), certName011);
 
@@ -1139,14 +1139,14 @@
   UpdateParam param5(keyName11, cert110->getPublicKeyInfo());
   auto interest5 = generateSignedInterest(param5, owner, cert100->getName());
 
-  face->sentDatas.clear();
-  face->receive(*interest5);
+  face.sentData.clear();
+  face.receive(*interest5);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_CHECK(cache.find(interest5->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibError result5;
-  BOOST_REQUIRE_NO_THROW(result5.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result5.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result5.getErrorCode(), ERR_SUCCESS);
   BOOST_CHECK_EQUAL(db.hasKey(keyName11), true);
 
@@ -1155,14 +1155,14 @@
   UpdateParam param6(*cert101);
   auto interest6 = generateSignedInterest(param6, owner, cert100->getName());
 
-  face->sentDatas.clear();
-  face->receive(*interest6);
+  face.sentData.clear();
+  face.receive(*interest6);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_CHECK(cache.find(interest6->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibError result6;
-  BOOST_REQUIRE_NO_THROW(result6.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result6.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result6.getErrorCode(), ERR_SUCCESS);
   BOOST_CHECK_EQUAL(db.hasCertificate(cert101->getName()), true);
 }
@@ -1171,7 +1171,7 @@
 {
   owner = "alice";
 
-  Pib pib(*face,
+  Pib pib(face,
           tmpPath.string(),
           m_keyChain.getTpm().getTpmLocator(),
           owner);
@@ -1186,13 +1186,13 @@
   DeleteParam param(Name(), TYPE_USER);
   auto interest = generateSignedInterest(param, owner, ownerMgmtCert.getName());
 
-  face->receive(*interest);
+  face.receive(*interest);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_CHECK(cache.find(interest->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibError result;
-  BOOST_REQUIRE_NO_THROW(result.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result.getErrorCode(), ERR_WRONG_PARAM);
 }
 
@@ -1200,7 +1200,7 @@
 {
   owner = "alice";
 
-  Pib pib(*face,
+  Pib pib(face,
           tmpPath.string(),
           m_keyChain.getTpm().getTpmLocator(),
           owner);
@@ -1242,14 +1242,14 @@
   DeleteParam param1(testIdCertName11, TYPE_CERT);
   auto interest1 = generateSignedInterest(param1, owner, testIdCertName11);
 
-  face->sentDatas.clear();
-  face->receive(*interest1);
+  face.sentData.clear();
+  face.receive(*interest1);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_CHECK(cache.find(interest1->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibError result1;
-  BOOST_REQUIRE_NO_THROW(result1.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result1.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result1.getErrorCode(), ERR_SUCCESS);
   BOOST_CHECK_EQUAL(db.hasCertificate(testIdCertName11), false);
 
@@ -1258,14 +1258,14 @@
   DeleteParam param2(testIdKeyName1, TYPE_KEY);
   auto interest2 = generateSignedInterest(param2, owner, testIdCertName11);
 
-  face->sentDatas.clear();
-  face->receive(*interest2);
+  face.sentData.clear();
+  face.receive(*interest2);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_CHECK(cache.find(interest2->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibError result2;
-  BOOST_REQUIRE_NO_THROW(result2.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result2.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result2.getErrorCode(), ERR_SUCCESS);
   BOOST_CHECK_EQUAL(db.hasKey(testIdKeyName1), false);
 
@@ -1275,14 +1275,14 @@
   DeleteParam param3(testId, TYPE_ID);
   auto interest3 = generateSignedInterest(param3, owner, testIdCertName11);
 
-  face->sentDatas.clear();
-  face->receive(*interest3);
+  face.sentData.clear();
+  face.receive(*interest3);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_CHECK(cache.find(interest3->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibError result3;
-  BOOST_REQUIRE_NO_THROW(result3.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result3.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result3.getErrorCode(), ERR_WRONG_SIGNER);
   BOOST_CHECK_EQUAL(db.hasIdentity(testId), true);
 
@@ -1290,14 +1290,14 @@
   DeleteParam param4(testId, TYPE_ID);
   auto interest4 = generateSignedInterest(param4, owner, testIdCertName00);
 
-  face->sentDatas.clear();
-  face->receive(*interest4);
+  face.sentData.clear();
+  face.receive(*interest4);
   advanceClocks(io, time::milliseconds(10), 10);
 
   BOOST_CHECK(cache.find(interest4->getName()) != nullptr);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
   PibError result4;
-  BOOST_REQUIRE_NO_THROW(result4.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+  BOOST_REQUIRE_NO_THROW(result4.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(result4.getErrorCode(), ERR_SUCCESS);
   BOOST_CHECK_EQUAL(db.hasIdentity(testId), false);
 }
@@ -1307,7 +1307,7 @@
   // Read Certificates;
   owner = "alice";
 
-  Pib pib(*face,
+  Pib pib(face,
           tmpPath.string(),
           m_keyChain.getTpm().getTpmLocator(),
           owner);
@@ -1342,44 +1342,44 @@
   auto interest10 = generateSignedInterest(param10, owner, ownerMgmtCert.getName());
   auto interest11 = generateSignedInterest(param11, owner, ownerMgmtCert.getName());
 
-  face->sentDatas.clear();
-  face->receive(*interest00);
+  face.sentData.clear();
+  face.receive(*interest00);
   advanceClocks(io, time::milliseconds(10), 10);
-  face->receive(*interest01);
+  face.receive(*interest01);
   advanceClocks(io, time::milliseconds(10), 10);
-  face->receive(*interest10);
+  face.receive(*interest10);
   advanceClocks(io, time::milliseconds(10), 10);
-  face->receive(*interest11);
+  face.receive(*interest11);
   advanceClocks(io, time::milliseconds(10), 10);
 
   auto interest1 = make_shared<Interest>(testIdCertName11);
-  face->sentDatas.clear();
-  face->receive(*interest1);
+  face.sentData.clear();
+  face.receive(*interest1);
   advanceClocks(io, time::milliseconds(10), 10);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
-  BOOST_CHECK(face->sentDatas[0].wireEncode() == cert11->wireEncode());
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+  BOOST_CHECK(face.sentData[0].wireEncode() == cert11->wireEncode());
 
   auto interest2 = make_shared<Interest>(testIdCertName11.getPrefix(-1));
-  face->sentDatas.clear();
-  face->receive(*interest2);
+  face.sentData.clear();
+  face.receive(*interest2);
   advanceClocks(io, time::milliseconds(10), 10);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
-  BOOST_CHECK_EQUAL(face->sentDatas[0].getName().getPrefix(-1),
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+  BOOST_CHECK_EQUAL(face.sentData[0].getName().getPrefix(-1),
                     cert11->getName().getPrefix(-1));
 
   auto interest3 = make_shared<Interest>(testIdCertName11.getPrefix(-1));
   pib.getDb().deleteCertificate(testIdCertName11);
-  face->sentDatas.clear();
-  face->receive(*interest3);
+  face.sentData.clear();
+  face.receive(*interest3);
   advanceClocks(io, time::milliseconds(10), 10);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
-  BOOST_CHECK(face->sentDatas[0].wireEncode() == cert10->wireEncode());
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+  BOOST_CHECK(face.sentData[0].wireEncode() == cert10->wireEncode());
 
   auto interest4 = make_shared<Interest>(testIdCertName11);
-  face->sentDatas.clear();
-  face->receive(*interest4);
+  face.sentData.clear();
+  face.receive(*interest4);
   advanceClocks(io, time::milliseconds(10), 10);
-  BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 0);
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 0);
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/ping/client/statistics-collector.t.cpp b/tests/ping/client/statistics-collector.t.cpp
index a1cc177..6093785 100644
--- a/tests/ping/client/statistics-collector.t.cpp
+++ b/tests/ping/client/statistics-collector.t.cpp
@@ -33,9 +33,8 @@
 {
 protected:
   StatisticsCollectorFixture()
-    : face(util::makeDummyClientFace())
-    , pingOptions(makeOptions())
-    , pingProgram(*face, pingOptions)
+    : pingOptions(makeOptions())
+    , pingProgram(face, pingOptions)
     , sc(pingProgram, pingOptions)
   {
   }
@@ -57,7 +56,7 @@
   }
 
 protected:
-  shared_ptr<util::DummyClientFace> face;
+  util::DummyClientFace face;
   Options pingOptions;
   Ping pingProgram;
   StatisticsCollector sc;
diff --git a/tests/ping/integrated.t.cpp b/tests/ping/integrated.t.cpp
index aec1896..fb6f1cc 100644
--- a/tests/ping/integrated.t.cpp
+++ b/tests/ping/integrated.t.cpp
@@ -34,35 +34,35 @@
 {
 public:
   PingIntegratedFixture()
-    : serverFace(util::makeDummyClientFace(io, {false, true}))
-    , clientFace(util::makeDummyClientFace(io, {false, true}))
+    : serverFace(io, m_keyChain, {false, true})
+    , clientFace(io, m_keyChain, {false, true})
     , wantLoss(false)
   {
-    serverFace->onSendInterest.connect([this] (const Interest& interest) {
-      io.post([=] { if (!wantLoss) { clientFace->receive(interest); } });
+    serverFace.onSendInterest.connect([this] (const Interest& interest) {
+      io.post([=] { if (!wantLoss) { clientFace.receive(interest); } });
     });
-    clientFace->onSendInterest.connect([this] (const Interest& interest) {
-      io.post([=] { if (!wantLoss) { serverFace->receive(interest); } });
+    clientFace.onSendInterest.connect([this] (const Interest& interest) {
+      io.post([=] { if (!wantLoss) { serverFace.receive(interest); } });
     });
-    serverFace->onSendData.connect([this] (const Data& data) {
-      io.post([=] { if (!wantLoss) { clientFace->receive(data); } });
+    serverFace.onSendData.connect([this] (const Data& data) {
+      io.post([=] { if (!wantLoss) { clientFace.receive(data); } });
     });
-    clientFace->onSendData.connect([this] (const Data& data) {
-      io.post([=] { if (!wantLoss) { serverFace->receive(data); } });
+    clientFace.onSendData.connect([this] (const Data& data) {
+      io.post([=] { if (!wantLoss) { serverFace.receive(data); } });
     });
   }
 
   void onFinish()
   {
-    serverFace->shutdown();
-    clientFace->shutdown();
+    serverFace.shutdown();
+    clientFace.shutdown();
     io.stop();
   }
 
 public:
   boost::asio::io_service io;
-  shared_ptr<util::DummyClientFace> serverFace;
-  shared_ptr<util::DummyClientFace> clientFace;
+  util::DummyClientFace serverFace;
+  util::DummyClientFace clientFace;
   std::unique_ptr<server::PingServer> server;
   std::unique_ptr<client::Ping> client;
   bool wantLoss;
@@ -78,7 +78,7 @@
   serverOpts.nMaxPings = 4;
   serverOpts.shouldPrintTimestamp = false;
   serverOpts.payloadSize = 0;
-  server.reset(new server::PingServer(*serverFace, m_keyChain, serverOpts));
+  server.reset(new server::PingServer(serverFace, m_keyChain, serverOpts));
   BOOST_REQUIRE_EQUAL(0, server->getNPings());
   server->start();
 
@@ -91,7 +91,7 @@
   clientOpts.interval = time::milliseconds(100);
   clientOpts.timeout = time::milliseconds(2000);
   clientOpts.startSeq = 1000;
-  client.reset(new client::Ping(*clientFace, clientOpts));
+  client.reset(new client::Ping(clientFace, clientOpts));
   client->afterFinish.connect(bind(&PingIntegratedFixture::onFinish, this));
   client->start();
 
@@ -111,7 +111,7 @@
   serverOpts.nMaxPings = 4;
   serverOpts.shouldPrintTimestamp = false;
   serverOpts.payloadSize = 0;
-  server.reset(new server::PingServer(*serverFace, m_keyChain, serverOpts));
+  server.reset(new server::PingServer(serverFace, m_keyChain, serverOpts));
   BOOST_REQUIRE_EQUAL(0, server->getNPings());
   server->start();
 
@@ -124,7 +124,7 @@
   clientOpts.interval = time::milliseconds(100);
   clientOpts.timeout = time::milliseconds(500);
   clientOpts.startSeq = 1000;
-  client.reset(new client::Ping(*clientFace, clientOpts));
+  client.reset(new client::Ping(clientFace, clientOpts));
   client->afterFinish.connect(bind(&PingIntegratedFixture::onFinish, this));
   client->start();
 
diff --git a/tests/ping/server/ping-server.t.cpp b/tests/ping/server/ping-server.t.cpp
index 81fb883..7d2a8da 100644
--- a/tests/ping/server/ping-server.t.cpp
+++ b/tests/ping/server/ping-server.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2015,  Arizona Board of Regents.
+ * Copyright (c) 2014-2016,  Arizona Board of Regents.
  *
  * This file is part of ndn-tools (Named Data Networking Essential Tools).
  * See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -36,9 +36,9 @@
 {
 protected:
   CreatePingServerFixture()
-    : face(util::makeDummyClientFace(io, {false, true}))
+    : face(io, m_keyChain, {false, true})
     , pingOptions(makeOptions())
-    , pingServer(*face, m_keyChain, pingOptions)
+    , pingServer(face, m_keyChain, pingOptions)
   {
   }
 
@@ -69,7 +69,7 @@
 
 protected:
   boost::asio::io_service io;
-  shared_ptr<util::DummyClientFace> face;
+  util::DummyClientFace face;
   Options pingOptions;
   PingServer pingServer;
 };
@@ -81,8 +81,8 @@
 
   this->advanceClocks(io, time::milliseconds(1), 200);
 
-  face->receive(makePingInterest(1000));
-  face->receive(makePingInterest(1001));
+  face.receive(makePingInterest(1000));
+  face.receive(makePingInterest(1001));
 
   io.run();
 
