diff --git a/tests/unit-tests/dummy-forwarder.cpp b/tests/unit-tests/dummy-forwarder.cpp
new file mode 100644
index 0000000..224dcd3
--- /dev/null
+++ b/tests/unit-tests/dummy-forwarder.cpp
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2012-2017 University of California, Los Angeles
+ *
+ * This file is part of ChronoSync, synchronization library for distributed realtime
+ * applications for NDN.
+ *
+ * ChronoSync is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * ChronoSync is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * ChronoSync, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "dummy-forwarder.hpp"
+
+#include <boost/asio/io_service.hpp>
+
+namespace ndn {
+namespace chronosync {
+
+DummyForwarder::DummyForwarder(boost::asio::io_service& io, KeyChain& keyChain)
+  : m_io(io)
+  , m_keyChain(keyChain)
+{
+}
+
+Face&
+DummyForwarder::addFace()
+{
+  auto face = std::make_shared<util::DummyClientFace>(m_io, m_keyChain,
+                                                      util::DummyClientFace::Options{true, true});
+  face->onSendInterest.connect([this, face] (const Interest& interest) {
+      Interest i(interest);
+      for (auto& otherFace : m_faces) {
+        if (&*face == &*otherFace) {
+          continue;
+        }
+        m_io.post([=] { otherFace->receive(i); });
+      }
+    });
+  face->onSendData.connect([this, face] (const Data& data) {
+      Data d(data);
+      for (auto& otherFace : m_faces) {
+        if (&*face == &*otherFace) {
+          continue;
+        }
+        m_io.post([=] { otherFace->receive(d); });
+      }
+    });
+
+  face->onSendNack.connect([this, face] (const lp::Nack& nack) {
+      lp::Nack n(nack);
+      for (auto& otherFace : m_faces) {
+        if (&*face == &*otherFace) {
+          continue;
+        }
+        m_io.post([=] { otherFace->receive(n); });
+      }
+    });
+
+  m_faces.push_back(face);
+  return *face;
+}
+
+} // namespace chronosync
+} // namespace ndn
diff --git a/tests/unit-tests/dummy-forwarder.hpp b/tests/unit-tests/dummy-forwarder.hpp
new file mode 100644
index 0000000..3e7d9b3
--- /dev/null
+++ b/tests/unit-tests/dummy-forwarder.hpp
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2012-2017 University of California, Los Angeles
+ *
+ * This file is part of ChronoSync, synchronization library for distributed realtime
+ * applications for NDN.
+ *
+ * ChronoSync is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * ChronoSync is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * ChronoSync, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <ndn-cxx/interest.hpp>
+#include <ndn-cxx/data.hpp>
+#include <ndn-cxx/lp/nack.hpp>
+#include <ndn-cxx/util/dummy-client-face.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
+
+#ifndef NDN_CHRONOSYNC_UNIT_TESTS_DUMMY_FORWARDER_HPP
+#define NDN_CHRONOSYNC_UNIT_TESTS_DUMMY_FORWARDER_HPP
+
+namespace ndn {
+namespace chronosync {
+
+/**
+ * @brief Very basic implementation of the dummy forwarder
+ *
+ * Interests expressed by any added face, will be forwarded to all other faces.
+ * Similarly, any pushed data, will be pushed to all other faces.
+ */
+class DummyForwarder
+{
+public:
+  DummyForwarder(boost::asio::io_service& io, KeyChain& keyChain);
+
+  Face&
+  addFace();
+
+  Face&
+  getFace(size_t nFace)
+  {
+    return *m_faces.at(nFace);
+  }
+
+private:
+  boost::asio::io_service& m_io;
+  KeyChain& m_keyChain;
+  std::vector<shared_ptr<util::DummyClientFace>> m_faces;
+};
+
+} // namespace chronosync
+} // namespace ndn
+
+#endif // NDN_CHRONOSYNC_UNIT_TESTS_DUMMY_FORWARDER_HPP
diff --git a/tests/unit-tests/test-interest-table.cpp b/tests/unit-tests/test-interest-table.cpp
index 0f0c95d..be0f289 100644
--- a/tests/unit-tests/test-interest-table.cpp
+++ b/tests/unit-tests/test-interest-table.cpp
@@ -37,37 +37,36 @@
     Name interestName1;
     digest1 = ndn::util::Sha256::computeDigest(origin, 1);
     interestName1.append(prefix).append(name::Component(digest1));
-    interest1 = make_shared<Interest>(interestName1);
-    interest1->setInterestLifetime(time::milliseconds(100));
+
+    interest1 = Interest(interestName1);
+    interest1.setInterestLifetime(time::milliseconds(100));
 
     Name interestName2;
     digest2 = ndn::util::Sha256::computeDigest(origin, 2);
     interestName2.append(prefix).append(name::Component(digest2));
-    interest2 = make_shared<Interest>(interestName2);
-    interest2->setInterestLifetime(time::milliseconds(100));
+    interest2 = Interest(interestName2);
+    interest2.setInterestLifetime(time::milliseconds(100));
 
     Name interestName3;
     digest3 = ndn::util::Sha256::computeDigest(origin, 3);
     interestName3.append(prefix).append(name::Component(digest3));
-    interest3 = make_shared<Interest>(interestName3);
-    interest3->setInterestLifetime(time::milliseconds(100));
+    interest3 = Interest(interestName3);
+    interest3.setInterestLifetime(time::milliseconds(100));
   }
 
   void
-  insert(InterestTable& table,
-         shared_ptr<Interest> interest,
-         ndn::ConstBufferPtr digest)
+  insert(InterestTable& table, const Interest& interest, ndn::ConstBufferPtr digest)
   {
     table.insert(interest, digest);
   }
 
-  shared_ptr<Interest> interest1;
+  Interest interest1;
   ndn::ConstBufferPtr digest1;
 
-  shared_ptr<Interest> interest2;
+  Interest interest2;
   ndn::ConstBufferPtr digest2;
 
-  shared_ptr<Interest> interest3;
+  Interest interest3;
   ndn::ConstBufferPtr digest3;
 };
 
diff --git a/tests/unit-tests/test-logic.cpp b/tests/unit-tests/test-logic.cpp
index 342af4c..a243bb0 100644
--- a/tests/unit-tests/test-logic.cpp
+++ b/tests/unit-tests/test-logic.cpp
@@ -18,20 +18,22 @@
  */
 
 #include "logic.hpp"
-#include "../unit-test-time-fixture.hpp"
-#include <ndn-cxx/util/dummy-client-face.hpp>
+
 #include "boost-test.hpp"
+#include "../identity-management-fixture.hpp"
+
+#include "dummy-forwarder.hpp"
 
 namespace chronosync {
 namespace test {
 
 using std::vector;
-using ndn::util::DummyClientFace;
+using ndn::chronosync::DummyForwarder;
 
 class Handler
 {
 public:
-  Handler(DummyClientFace& face,
+  Handler(ndn::Face& face,
           const Name& syncPrefix,
           const Name& userPrefix)
     : logic(face,
@@ -66,64 +68,30 @@
   std::map<Name, SeqNo> map;
 };
 
-class LogicFixture : public ndn::tests::UnitTestTimeFixture
+class LogicFixture : public ndn::tests::IdentityManagementTimeFixture
 {
 public:
   LogicFixture()
     : syncPrefix("/ndn/broadcast/sync")
+    , fw(io, m_keyChain)
   {
     syncPrefix.appendVersion();
     userPrefix[0] = Name("/user0");
     userPrefix[1] = Name("/user1");
     userPrefix[2] = Name("/user2");
     userPrefix[3] = Name("/user3");
-
-    faces[0].reset(new DummyClientFace(io, {true, true}));
-    faces[1].reset(new DummyClientFace(io, {true, true}));
-    faces[2].reset(new DummyClientFace(io, {true, true}));
-    faces[3].reset(new DummyClientFace(io, {true, true}));
-
-    for (int i = 0; i < 4; i++) {
-      readInterestOffset[i] = 0;
-      readDataOffset[i] = 0;
-    }
-  }
-
-  void
-  passPacket()
-  {
-    for (int i = 0; i < 4; i++)
-      checkFace(i);
-  }
-
-  void
-  checkFace(int sender)
-  {
-    while (faces[sender]->sentInterests.size() > readInterestOffset[sender]) {
-      for (int i = 0; i < 4; i++) {
-        if (sender != i)
-          faces[i]->receive(faces[sender]->sentInterests[readInterestOffset[sender]]);
-      }
-      readInterestOffset[sender]++;
-    }
-    while (faces[sender]->sentData.size() > readDataOffset[sender]) {
-      for (int i = 0; i < 4; i++) {
-        if (sender != i)
-          faces[i]->receive(faces[sender]->sentData[readDataOffset[sender]]);
-      }
-      readDataOffset[sender]++;
-    }
   }
 
 public:
   Name syncPrefix;
   Name userPrefix[4];
 
-  std::unique_ptr<DummyClientFace> faces[4];
+  DummyForwarder fw;
+  // std::unique_ptr<DummyClientFace> faces[4];
   shared_ptr<Handler> handler[4];
 
-  size_t readInterestOffset[4];
-  size_t readDataOffset[4];
+  // size_t readInterestOffset[4];
+  // size_t readDataOffset[4];
 };
 
 BOOST_FIXTURE_TEST_SUITE(LogicTests, LogicFixture)
@@ -137,156 +105,120 @@
 {
   Name syncPrefix("/ndn/broadcast/sync");
   Name userPrefix("/user");
-  DummyClientFace face(io, {true, true});
-  BOOST_REQUIRE_NO_THROW(Logic(face, syncPrefix, userPrefix,
-                               bind(onUpdate, _1)));
+  ndn::util::DummyClientFace face(io, {true, true});
+  BOOST_REQUIRE_NO_THROW(Logic(face, syncPrefix, userPrefix, bind(onUpdate, _1)));
 }
 
 BOOST_AUTO_TEST_CASE(TwoBasic)
 {
-  handler[0] = make_shared<Handler>(ref(*faces[0]), syncPrefix, userPrefix[0]);
-  advanceClocks(ndn::time::milliseconds(10), 10);
+  handler[0] = make_shared<Handler>(ref(fw.addFace()), syncPrefix, userPrefix[0]);
+  advanceClocks(ndn::time::milliseconds(10), 100);
 
-  handler[1] = make_shared<Handler>(ref(*faces[1]), syncPrefix, userPrefix[1]);
-  advanceClocks(ndn::time::milliseconds(10), 10);
+  handler[1] = make_shared<Handler>(ref(fw.addFace()), syncPrefix, userPrefix[1]);
+  advanceClocks(ndn::time::milliseconds(10), 100);
 
   handler[0]->updateSeqNo(1);
 
-  for (int i = 0; i < 50; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
+
   BOOST_CHECK_EQUAL(handler[1]->map[handler[0]->logic.getSessionName()], 1);
-  advanceClocks(ndn::time::milliseconds(10), 10);
+  advanceClocks(ndn::time::milliseconds(10), 100);
 
   handler[0]->updateSeqNo(2);
 
-  for (int i = 0; i < 50; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(handler[1]->map[handler[0]->logic.getSessionName()], 2);
-  advanceClocks(ndn::time::milliseconds(10), 10);
+  advanceClocks(ndn::time::milliseconds(10), 100);
 
   handler[1]->updateSeqNo(2);
 
-  for (int i = 0; i < 50; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(handler[0]->map[handler[1]->logic.getSessionName()], 2);
 }
 
 BOOST_AUTO_TEST_CASE(ThreeBasic)
 {
-  handler[0] = make_shared<Handler>(ref(*faces[0]), syncPrefix, userPrefix[0]);
-  advanceClocks(ndn::time::milliseconds(10), 10);
+  handler[0] = make_shared<Handler>(ref(fw.addFace()), syncPrefix, userPrefix[0]);
+  advanceClocks(ndn::time::milliseconds(10), 100);
 
-  handler[1] = make_shared<Handler>(ref(*faces[1]), syncPrefix, userPrefix[1]);
-  advanceClocks(ndn::time::milliseconds(10), 10);
+  handler[1] = make_shared<Handler>(ref(fw.addFace()), syncPrefix, userPrefix[1]);
+  advanceClocks(ndn::time::milliseconds(10), 100);
 
-  handler[2] = make_shared<Handler>(ref(*faces[2]), syncPrefix, userPrefix[2]);
-  advanceClocks(ndn::time::milliseconds(10), 20);
+  handler[2] = make_shared<Handler>(ref(fw.addFace()), syncPrefix, userPrefix[2]);
+  advanceClocks(ndn::time::milliseconds(10), 100);
 
   handler[0]->updateSeqNo(1);
 
-  for (int i = 0; i < 70; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(handler[1]->map[handler[0]->logic.getSessionName()], 1);
   BOOST_CHECK_EQUAL(handler[2]->map[handler[0]->logic.getSessionName()], 1);
 
   handler[1]->updateSeqNo(2);
 
-  for (int i = 0; i < 50; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(handler[0]->map[handler[1]->logic.getSessionName()], 2);
   BOOST_CHECK_EQUAL(handler[2]->map[handler[1]->logic.getSessionName()], 2);
 
   handler[2]->updateSeqNo(4);
 
-  for (int i = 0; i < 100; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(handler[0]->map[handler[2]->logic.getSessionName()], 4);
   BOOST_CHECK_EQUAL(handler[1]->map[handler[2]->logic.getSessionName()], 4);
 }
 
 BOOST_AUTO_TEST_CASE(ResetRecover)
 {
-  handler[0] = make_shared<Handler>(ref(*faces[0]), syncPrefix, userPrefix[0]);
-  advanceClocks(ndn::time::milliseconds(10), 10);
+  handler[0] = make_shared<Handler>(ref(fw.addFace()), syncPrefix, userPrefix[0]);
+  advanceClocks(ndn::time::milliseconds(10), 100);
 
-  handler[1] = make_shared<Handler>(ref(*faces[1]), syncPrefix, userPrefix[1]);
-  advanceClocks(ndn::time::milliseconds(10), 30);
+  handler[1] = make_shared<Handler>(ref(fw.addFace()), syncPrefix, userPrefix[1]);
+  advanceClocks(ndn::time::milliseconds(10), 100);
 
   handler[0]->updateSeqNo(1);
 
-  for (int i = 0; i < 50; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(handler[1]->map[handler[0]->logic.getSessionName()], 1);
 
   handler[1]->updateSeqNo(2);
 
-  for (int i = 0; i < 50; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(handler[0]->map[handler[1]->logic.getSessionName()], 2);
 
-  advanceClocks(ndn::time::milliseconds(10), 10);
-  handler[2] = make_shared<Handler>(ref(*faces[2]), syncPrefix, userPrefix[2]);
+  advanceClocks(ndn::time::milliseconds(10), 100);
+  handler[2] = make_shared<Handler>(ref(fw.addFace()), syncPrefix, userPrefix[2]);
 
-  for (int i = 0; i < 50; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(handler[2]->map[handler[0]->logic.getSessionName()], 1);
   BOOST_CHECK_EQUAL(handler[2]->map[handler[1]->logic.getSessionName()], 2);
 
   handler[2]->updateSeqNo(4);
 
-  for (int i = 0; i < 50; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(handler[1]->map[handler[2]->logic.getSessionName()], 4);
   BOOST_CHECK_EQUAL(handler[0]->map[handler[2]->logic.getSessionName()], 4);
 }
 
 BOOST_AUTO_TEST_CASE(RecoverConflict)
 {
-  handler[0] = make_shared<Handler>(ref(*faces[0]), syncPrefix, userPrefix[0]);
-  advanceClocks(ndn::time::milliseconds(10), 10);
+  handler[0] = make_shared<Handler>(ref(fw.addFace()), syncPrefix, userPrefix[0]);
+  advanceClocks(ndn::time::milliseconds(10), 100);
 
-  handler[1] = make_shared<Handler>(ref(*faces[1]), syncPrefix, userPrefix[1]);
-  advanceClocks(ndn::time::milliseconds(10), 10);
+  handler[1] = make_shared<Handler>(ref(fw.addFace()), syncPrefix, userPrefix[1]);
+  advanceClocks(ndn::time::milliseconds(10), 100);
 
-  handler[2] = make_shared<Handler>(ref(*faces[2]), syncPrefix, userPrefix[2]);
-  advanceClocks(ndn::time::milliseconds(10), 30);
+  handler[2] = make_shared<Handler>(ref(fw.addFace()), syncPrefix, userPrefix[2]);
+  advanceClocks(ndn::time::milliseconds(10), 100);
 
   handler[0]->updateSeqNo(1);
 
-  for (int i = 0; i < 50; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(handler[1]->map[handler[0]->logic.getSessionName()], 1);
   BOOST_CHECK_EQUAL(handler[2]->map[handler[0]->logic.getSessionName()], 1);
 
   handler[1]->updateSeqNo(2);
   handler[2]->updateSeqNo(4);
 
-  for (int i = 0; i < 75; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(handler[0]->map[handler[1]->logic.getSessionName()], 2);
   BOOST_CHECK_EQUAL(handler[0]->map[handler[2]->logic.getSessionName()], 4);
   BOOST_CHECK_EQUAL(handler[1]->map[handler[2]->logic.getSessionName()], 4);
@@ -295,34 +227,28 @@
 
 BOOST_AUTO_TEST_CASE(PartitionRecover)
 {
-  handler[0] = make_shared<Handler>(ref(*faces[0]), syncPrefix, userPrefix[0]);
-  advanceClocks(ndn::time::milliseconds(10), 10);
+  handler[0] = make_shared<Handler>(ref(fw.addFace()), syncPrefix, userPrefix[0]);
+  advanceClocks(ndn::time::milliseconds(10), 100);
 
-  handler[1] = make_shared<Handler>(ref(*faces[1]), syncPrefix, userPrefix[1]);
-  advanceClocks(ndn::time::milliseconds(10), 10);
+  handler[1] = make_shared<Handler>(ref(fw.addFace()), syncPrefix, userPrefix[1]);
+  advanceClocks(ndn::time::milliseconds(10), 100);
 
-  handler[2] = make_shared<Handler>(ref(*faces[2]), syncPrefix, userPrefix[2]);
-  advanceClocks(ndn::time::milliseconds(10), 10);
+  handler[2] = make_shared<Handler>(ref(fw.addFace()), syncPrefix, userPrefix[2]);
+  advanceClocks(ndn::time::milliseconds(10), 100);
 
-  handler[3] = make_shared<Handler>(ref(*faces[3]), syncPrefix, userPrefix[3]);
-  advanceClocks(ndn::time::milliseconds(10), 30);
+  handler[3] = make_shared<Handler>(ref(fw.addFace()), syncPrefix, userPrefix[3]);
+  advanceClocks(ndn::time::milliseconds(10), 100);
 
   handler[0]->updateSeqNo(1);
 
-  for (int i = 0; i < 50; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(handler[1]->map[handler[0]->logic.getSessionName()], 1);
   BOOST_CHECK_EQUAL(handler[2]->map[handler[0]->logic.getSessionName()], 1);
   BOOST_CHECK_EQUAL(handler[3]->map[handler[0]->logic.getSessionName()], 1);
 
   handler[2]->updateSeqNo(2);
 
-  for (int i = 0; i < 50; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(handler[0]->map[handler[2]->logic.getSessionName()], 2);
   BOOST_CHECK_EQUAL(handler[1]->map[handler[2]->logic.getSessionName()], 2);
   BOOST_CHECK_EQUAL(handler[3]->map[handler[2]->logic.getSessionName()], 2);
@@ -331,20 +257,14 @@
 
   handler[1]->updateSeqNo(3);
 
-  for (int i = 0; i < 50; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(handler[0]->map[handler[1]->logic.getSessionName()], 3);
   handler[2]->map[handler[1]->logic.getSessionName()] = 0;
   handler[3]->map[handler[1]->logic.getSessionName()] = 0;
 
   handler[3]->updateSeqNo(4);
 
-  for (int i = 0; i < 50; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(handler[2]->map[handler[3]->logic.getSessionName()], 4);
   handler[0]->map[handler[3]->logic.getSessionName()] = 0;
   handler[1]->map[handler[3]->logic.getSessionName()] = 0;
@@ -353,20 +273,14 @@
 
   handler[0]->updateSeqNo(5);
 
-  for (int i = 0; i < 50; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(handler[1]->map[handler[0]->logic.getSessionName()], 5);
   BOOST_CHECK_EQUAL(handler[2]->map[handler[0]->logic.getSessionName()], 5);
   BOOST_CHECK_EQUAL(handler[3]->map[handler[0]->logic.getSessionName()], 5);
 
   handler[2]->updateSeqNo(6);
 
-  for (int i = 0; i < 50; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(handler[0]->map[handler[2]->logic.getSessionName()], 6);
   BOOST_CHECK_EQUAL(handler[1]->map[handler[2]->logic.getSessionName()], 6);
   BOOST_CHECK_EQUAL(handler[3]->map[handler[2]->logic.getSessionName()], 6);
@@ -374,49 +288,34 @@
 
 BOOST_AUTO_TEST_CASE(MultipleUserUnderOneLogic)
 {
-  handler[0] = make_shared<Handler>(ref(*faces[0]), syncPrefix, userPrefix[0]);
-  advanceClocks(ndn::time::milliseconds(10), 10);
+  handler[0] = make_shared<Handler>(ref(fw.addFace()), syncPrefix, userPrefix[0]);
+  advanceClocks(ndn::time::milliseconds(10), 100);
 
-  handler[1] = make_shared<Handler>(ref(*faces[1]), syncPrefix, userPrefix[2]);
-  advanceClocks(ndn::time::milliseconds(10), 10);
+  handler[1] = make_shared<Handler>(ref(fw.addFace()), syncPrefix, userPrefix[2]);
+  advanceClocks(ndn::time::milliseconds(10), 100);
 
   handler[0]->logic.addUserNode(userPrefix[1]);
 
-  for (int i = 0; i < 20; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
 
   handler[0]->updateSeqNo(1);
 
-  for (int i = 0; i < 50; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(handler[1]->map[handler[0]->logic.getSessionName()], 1);
 
   handler[0]->logic.updateSeqNo(2, userPrefix[1]);
 
-  for (int i = 0; i < 50; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(handler[1]->map[handler[0]->logic.getSessionName(userPrefix[1])], 2);
 
   handler[1]->updateSeqNo(4);
 
-  for (int i = 0; i < 50; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(10), 100);
   BOOST_CHECK_EQUAL(handler[0]->map[handler[1]->logic.getSessionName()], 4);
 
   handler[0]->logic.removeUserNode(userPrefix[0]);
 
-  for (int i = 0; i < 100; i++) {
-    advanceClocks(ndn::time::milliseconds(2), 10);
-    passPacket();
-  }
+  advanceClocks(ndn::time::milliseconds(50), 100);
   BOOST_CHECK_EQUAL(handler[1]->logic.getSessionNames().size(), 2);
 }
 
diff --git a/tests/unit-tests/test-socket.cpp b/tests/unit-tests/test-socket.cpp
index 0c478ec..3fd0d26 100644
--- a/tests/unit-tests/test-socket.cpp
+++ b/tests/unit-tests/test-socket.cpp
@@ -18,9 +18,11 @@
  */
 
 #include "socket.hpp"
-#include "../unit-test-time-fixture.hpp"
-#include <ndn-cxx/util/dummy-client-face.hpp>
+
 #include "boost-test.hpp"
+#include "../unit-test-time-fixture.hpp"
+
+#include <ndn-cxx/util/dummy-client-face.hpp>
 
 namespace chronosync {
 namespace test {
@@ -30,7 +32,6 @@
 using std::map;
 using ndn::util::DummyClientFace;
 
-
 /**
  * @brief Emulate an app that use the Socket class
  *
@@ -54,12 +55,12 @@
   }
 
   void
-  set(const shared_ptr<const Data>& dataPacket)
+  set(const Data& dataPacket)
   {
     // std::cerr << "set Data" << std::endl;
-    Name dataName(dataPacket->getName());
-    string str2(reinterpret_cast<const char*>(dataPacket->getContent().value()),
-                dataPacket->getContent().value_size());
+    Name dataName(dataPacket.getName());
+    string str2(reinterpret_cast<const char*>(dataPacket.getContent().value()),
+                dataPacket.getContent().value_size());
     data.insert(make_pair(dataName, str2));
   }
 
@@ -71,11 +72,11 @@
   }
 
   void
-  setNum(const shared_ptr<const Data>& dataPacket)
+  setNum(const Data& dataPacket)
   {
     // std::cerr << "setNum Data" << std::endl;
-    size_t n = dataPacket->getContent().value_size() / 4;
-    const uint32_t* numbers = reinterpret_cast<const uint32_t*>(dataPacket->getContent().value());
+    size_t n = dataPacket.getContent().value_size() / 4;
+    const uint32_t* numbers = reinterpret_cast<const uint32_t*>(dataPacket.getContent().value());
     for (size_t i = 0; i < n; i++) {
       sum += numbers[i];
     }
@@ -99,7 +100,7 @@
     // std::cerr << "fetchAll" << std::endl;
     for (size_t i = 0; i < v.size(); i++) {
       for(SeqNo s = v[i].low; s <= v[i].high; ++s) {
-        socket.fetchData(v[i].session, s, [this] (const shared_ptr<const Data>& dataPacket) {
+        socket.fetchData(v[i].session, s, [this] (const Data& dataPacket) {
             this->set(dataPacket);
           });
       }
@@ -112,7 +113,7 @@
     // std::cerr << "fetchNumbers" << std::endl;
     for (size_t i = 0; i < v.size(); i++) {
       for(SeqNo s = v[i].low; s <= v[i].high; ++s) {
-        socket.fetchData(v[i].session, s, [this] (const shared_ptr<const Data>& dataPacket) {
+        socket.fetchData(v[i].session, s, [this] (const Data& dataPacket) {
             this->setNum(dataPacket);
           });
       }
diff --git a/tests/unit-tests/test-state.cpp b/tests/unit-tests/test-state.cpp
index ed88373..9e7ce58 100644
--- a/tests/unit-tests/test-state.cpp
+++ b/tests/unit-tests/test-state.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2012-2014 University of California, Los Angeles
+ * Copyright (c) 2012-2017 University of California, Los Angeles
  *
  * This file is part of ChronoSync, synchronization library for distributed realtime
  * applications for NDN.
@@ -18,12 +18,13 @@
  */
 
 #include "state.hpp"
+
 #include "boost-test.hpp"
 
 namespace chronosync {
 namespace test {
 
-using boost::tuple;
+using std::tuple;
 
 BOOST_AUTO_TEST_SUITE(StateTests)
 
@@ -43,21 +44,21 @@
 
   tuple<bool, bool, SeqNo> result;
   result = state.update(info, 12);
-  BOOST_CHECK_EQUAL(result.get<0>(), true);
-  BOOST_CHECK_EQUAL(result.get<1>(), false);
-  BOOST_CHECK_EQUAL(result.get<2>(), 0);
+  BOOST_CHECK_EQUAL(std::get<0>(result), true);
+  BOOST_CHECK_EQUAL(std::get<1>(result), false);
+  BOOST_CHECK_EQUAL(std::get<2>(result), 0);
 
   BOOST_CHECK_NO_THROW(state.update(info, 12));
   result = state.update(info, 12);
-  BOOST_CHECK_EQUAL(result.get<0>(), false);
-  BOOST_CHECK_EQUAL(result.get<1>(), false);
-  BOOST_CHECK_EQUAL(result.get<2>(), 0);
+  BOOST_CHECK_EQUAL(std::get<0>(result), false);
+  BOOST_CHECK_EQUAL(std::get<1>(result), false);
+  BOOST_CHECK_EQUAL(std::get<2>(result), 0);
 
   BOOST_CHECK_NO_THROW(state.update(info, 11));
   result = state.update(info, 11);
-  BOOST_CHECK_EQUAL(result.get<0>(), false);
-  BOOST_CHECK_EQUAL(result.get<1>(), false);
-  BOOST_CHECK_EQUAL(result.get<2>(), 0);
+  BOOST_CHECK_EQUAL(std::get<0>(result), false);
+  BOOST_CHECK_EQUAL(std::get<1>(result), false);
+  BOOST_CHECK_EQUAL(std::get<2>(result), 0);
 
   BOOST_CHECK_EQUAL(state.getLeaves().size(), 1);
   BOOST_CHECK_EQUAL((*state.getLeaves().begin())->getSeq(), 12);
@@ -67,9 +68,9 @@
   BOOST_CHECK_EQUAL((*state.getLeaves().begin())->getSeq(), 13);
 
   result = state.update(info, 14);
-  BOOST_CHECK_EQUAL(result.get<0>(), false);
-  BOOST_CHECK_EQUAL(result.get<1>(), true);
-  BOOST_CHECK_EQUAL(result.get<2>(), 13);
+  BOOST_CHECK_EQUAL(std::get<0>(result), false);
+  BOOST_CHECK_EQUAL(std::get<1>(result), true);
+  BOOST_CHECK_EQUAL(std::get<2>(result), 13);
 
   BOOST_CHECK_EQUAL(state.getLeaves().size(), 1);
   BOOST_CHECK_EQUAL((*state.getLeaves().begin())->getSeq(), 14);
