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()
