diff --git a/tests/unit-tests/dummy-client-face.hpp b/tests/unit-tests/dummy-client-face.hpp
index b744882..82d9c7c 100644
--- a/tests/unit-tests/dummy-client-face.hpp
+++ b/tests/unit-tests/dummy-client-face.hpp
@@ -24,6 +24,9 @@
 
 #include "face.hpp"
 #include "transport/transport.hpp"
+#include "management/nfd-controller.hpp"
+#include "management/nfd-control-response.hpp"
+#include "util/event-emitter.hpp"
 
 namespace ndn {
 namespace tests {
@@ -57,10 +60,12 @@
   send(const Block& wire)
   {
     if (wire.type() == tlv::Interest) {
-      m_sentInterests->push_back(Interest(wire));
+      shared_ptr<Interest> interest = make_shared<Interest>(wire);
+      (*m_onInterest)(*interest, this);
     }
     else if (wire.type() == tlv::Data) {
-      m_sentDatas->push_back(Data(wire));
+      shared_ptr<Data> data = make_shared<Data>(wire);
+      (*m_onData)(*data, this);
     }
   }
 
@@ -70,12 +75,45 @@
     this->send(payload);
   }
 
-public:
-  std::vector<Interest>* m_sentInterests;
-  std::vector<Data>*     m_sentDatas;
+  boost::asio::io_service&
+  getIoService()
+  {
+    return *m_ioService;
+  }
+
+private:
+  friend class DummyClientFace;
+  util::EventEmitter<Interest, DummyClientTransport*>* m_onInterest;
+  util::EventEmitter<Data, DummyClientTransport*>* m_onData;
 };
 
 
+/** \brief Callback to connect
+ */
+inline void
+replyNfdRibCommands(const Interest& interest, DummyClientTransport* transport)
+{
+  static const Name localhostRegistration("/localhost/nfd/rib");
+  if (localhostRegistration.isPrefixOf(interest.getName())) {
+    shared_ptr<Data> okResponse = make_shared<Data>(interest.getName());
+    nfd::ControlParameters params(interest.getName().get(-5).blockFromValue());
+    params.setFaceId(1);
+    params.setOrigin(0);
+    if (interest.getName().get(3) == name::Component("register")) {
+      params.setCost(0);
+    }
+    nfd::ControlResponse resp;
+    resp.setCode(200);
+    resp.setBody(params.wireEncode());
+    okResponse->setContent(resp.wireEncode());
+    KeyChain keyChain;
+    keyChain.signWithSha256(*okResponse);
+
+    transport->getIoService().post(bind(&DummyClientTransport::receive, transport,
+                                        okResponse->wireEncode()));
+  }
+}
+
 /** \brief a client-side face for unit testing
  */
 class DummyClientFace : public ndn::Face
@@ -86,16 +124,20 @@
     : Face(transport)
     , m_transport(transport)
   {
-    m_transport->m_sentInterests = &m_sentInterests;
-    m_transport->m_sentDatas     = &m_sentDatas;
+    m_transport->m_onInterest = &onInterest;
+    m_transport->m_onData     = &onData;
+
+    enablePacketLogging();
   }
 
   DummyClientFace(shared_ptr<DummyClientTransport> transport, boost::asio::io_service& ioService)
     : Face(transport, ioService)
     , m_transport(transport)
   {
-    m_transport->m_sentInterests = &m_sentInterests;
-    m_transport->m_sentDatas     = &m_sentDatas;
+    m_transport->m_onInterest = &onInterest;
+    m_transport->m_onData     = &onData;
+
+    enablePacketLogging();
   }
 
   /** \brief cause the Face to receive a packet
@@ -107,6 +149,26 @@
     m_transport->receive(packet.wireEncode());
   }
 
+  void
+  enablePacketLogging()
+  {
+    // @todo Replace with C++11 lambdas
+
+    onInterest += bind(static_cast<void(std::vector<Interest>::*)(const Interest&)>(
+                         &std::vector<Interest>::push_back),
+                       &m_sentInterests, _1);
+
+    onData += bind(static_cast<void(std::vector<Data>::*)(const Data&)>(
+                     &std::vector<Data>::push_back),
+                   &m_sentDatas, _1);
+  }
+
+  void
+  enableRegistrationReply()
+  {
+    onInterest += &replyNfdRibCommands;
+  }
+
 public:
   /** \brief sent Interests
    *  \note After .expressInterest, .processEvents must be called before
@@ -119,6 +181,19 @@
    */
   std::vector<Data>     m_sentDatas;
 
+public:
+  /** \brief Event to be called whenever an Interest is received
+   *  \note After .expressInterest, .processEvents must be called before
+   *        the Interest would show up here.
+   */
+  util::EventEmitter<Interest, DummyClientTransport*> onInterest;
+
+  /** \brief Event to be called whenever a Data packet is received
+   *  \note After .put, .processEvents must be called before
+   *        the Interest would show up here.
+   */
+  util::EventEmitter<Data, DummyClientTransport*> onData;
+
 private:
   shared_ptr<DummyClientTransport> m_transport;
 };
@@ -135,6 +210,7 @@
   return make_shared<DummyClientFace>(make_shared<DummyClientTransport>(), ref(ioService));
 }
 
+
 } // namespace tests
 } // namespace ndn
 
diff --git a/tests/unit-tests/test-faces.cpp b/tests/unit-tests/test-faces.cpp
new file mode 100644
index 0000000..f5b45f1
--- /dev/null
+++ b/tests/unit-tests/test-faces.cpp
@@ -0,0 +1,381 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2014 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#include "face.hpp"
+#include "util/scheduler.hpp"
+#include "security/key-chain.hpp"
+
+#include "boost-test.hpp"
+
+#include "dummy-client-face.hpp"
+
+namespace ndn {
+namespace tests {
+
+class FacesFixture
+{
+public:
+  FacesFixture()
+    : face(makeDummyClientFace(io))
+    , nData(0)
+    , nTimeouts(0)
+    , nInInterests(0)
+    , nInInterests2(0)
+    , nRegSuccesses(0)
+    , nRegFailures(0)
+    , nUnregSuccesses(0)
+    , nUnregFailures(0)
+  {
+  }
+
+  void
+  onData()
+  {
+    ++nData;
+  }
+
+  void
+  onTimeout()
+  {
+    ++nTimeouts;
+  }
+
+  void
+  onInterest(Face& face,
+             const Name&, const Interest&)
+  {
+    ++nInInterests;
+  }
+
+  void
+  onInterest2(Face& face,
+              const Name&, const Interest&)
+  {
+    ++nInInterests2;
+  }
+
+  void
+  onInterestRegex(Face& face,
+                  const InterestFilter&, const Interest&)
+  {
+    ++nInInterests;
+  }
+
+  void
+  onInterestRegexError(Face& face,
+                       const Name&, const Interest&)
+  {
+    BOOST_FAIL("InterestFilter::Error should have been triggered");
+  }
+
+  void
+  onRegSucceeded()
+  {
+    ++nRegSuccesses;
+  }
+
+  void
+  onRegFailed()
+  {
+    ++nRegFailures;
+  }
+
+  void
+  onUnregSucceeded()
+  {
+    ++nUnregSuccesses;
+  }
+
+  void
+  onUnregFailed()
+  {
+    ++nUnregFailures;
+  }
+
+  shared_ptr<Data>
+  makeData(const Name& name)
+  {
+    shared_ptr<Data> data = make_shared<Data>("/Hello/World/!");
+    static KeyChain keyChain;
+    keyChain.signWithSha256(*data);
+    return data;
+  }
+
+  boost::asio::io_service io;
+  shared_ptr<DummyClientFace> face;
+
+  uint32_t nData;
+  uint32_t nTimeouts;
+
+  uint32_t nInInterests;
+  uint32_t nInInterests2;
+  uint32_t nRegSuccesses;
+  uint32_t nRegFailures;
+  uint32_t nUnregSuccesses;
+  uint32_t nUnregFailures;
+};
+
+BOOST_FIXTURE_TEST_SUITE(TestFaces, FacesFixture)
+
+BOOST_AUTO_TEST_CASE(ExpressInterestData)
+{
+  face->enableRegistrationReply();
+
+  face->expressInterest(Interest("/Hello/World", time::milliseconds(50)),
+                        bind(&FacesFixture::onData, this),
+                        bind(&FacesFixture::onTimeout, this));
+
+  BOOST_REQUIRE_NO_THROW(face->processEvents(time::milliseconds(-100)));
+
+  face->receive(*makeData("/Hello/World/!"));
+  BOOST_REQUIRE_NO_THROW(face->processEvents(time::milliseconds(200)));
+
+  BOOST_CHECK_EQUAL(nData, 1);
+  BOOST_CHECK_EQUAL(nTimeouts, 0);
+}
+
+BOOST_AUTO_TEST_CASE(ExpressInterestTimeout)
+{
+  face->enableRegistrationReply();
+
+  face->expressInterest(Interest("/Hello/World", time::milliseconds(50)),
+                        bind(&FacesFixture::onData, this),
+                        bind(&FacesFixture::onTimeout, this));
+
+  BOOST_REQUIRE_NO_THROW(face->processEvents(time::milliseconds(200)));
+
+  BOOST_CHECK_EQUAL(nData, 0);
+  BOOST_CHECK_EQUAL(nTimeouts, 1);
+}
+
+BOOST_AUTO_TEST_CASE(SetFilter)
+{
+  face->enableRegistrationReply();
+
+  face->setInterestFilter("/Hello/World",
+                          bind(&FacesFixture::onInterest, this, ref(*face), _1, _2),
+                          RegisterPrefixSuccessCallback(),
+                          bind(&FacesFixture::onRegFailed, this));
+
+  BOOST_REQUIRE_NO_THROW(face->processEvents(time::milliseconds(-100)));
+
+  face->receive(Interest("/Hello/World/!"));
+  BOOST_REQUIRE_NO_THROW(face->processEvents(time::milliseconds(-100)));
+
+  BOOST_CHECK_EQUAL(nRegFailures, 0);
+  BOOST_CHECK_EQUAL(nInInterests, 1);
+}
+
+BOOST_AUTO_TEST_CASE(SetFilterFail)
+{
+  // don't enable registration reply
+
+  face->setInterestFilter("/Hello/World",
+                          bind(&FacesFixture::onInterest, this, ref(*face), _1, _2),
+                          RegisterPrefixSuccessCallback(),
+                          bind(&FacesFixture::onRegFailed, this));
+
+  BOOST_REQUIRE_NO_THROW(face->processEvents(time::milliseconds(11000)));
+
+  BOOST_CHECK_EQUAL(nRegFailures, 1);
+}
+
+BOOST_AUTO_TEST_CASE(SetUnsetInterestFilter)
+{
+  face->enableRegistrationReply();
+
+  const RegisteredPrefixId* regPrefixId =
+    face->setInterestFilter(InterestFilter("/Hello/World"),
+                            bind(&FacesFixture::onInterest, this,
+                                 ref(*face), _1, _2),
+                            RegisterPrefixSuccessCallback(),
+                            bind(&FacesFixture::onRegFailed, this));
+  BOOST_REQUIRE_NO_THROW(face->processEvents(time::milliseconds(100)));
+
+  face->receive(Interest("/Hello/World/!"));
+  BOOST_CHECK_EQUAL(nInInterests, 1);
+
+  BOOST_REQUIRE_NO_THROW(face->processEvents(time::milliseconds(100)));
+
+  face->receive(Interest("/Hello/World/!"));
+  BOOST_CHECK_EQUAL(nInInterests, 2);
+
+  face->unsetInterestFilter(regPrefixId);
+
+  BOOST_REQUIRE_NO_THROW(face->processEvents(time::milliseconds(100)));
+
+  face->receive(Interest("/Hello/World/!"));
+  BOOST_CHECK_EQUAL(nInInterests, 2);
+
+  BOOST_CHECK_NO_THROW(face->unsetInterestFilter(static_cast<const RegisteredPrefixId*>(0)));
+  BOOST_REQUIRE_NO_THROW(face->processEvents(time::milliseconds(100)));
+
+  BOOST_CHECK_NO_THROW(face->unsetInterestFilter(static_cast<const InterestFilterId*>(0)));
+  BOOST_REQUIRE_NO_THROW(face->processEvents(time::milliseconds(100)));
+}
+
+BOOST_AUTO_TEST_CASE(RegisterUnregisterPrefix)
+{
+  face->enableRegistrationReply();
+
+  const RegisteredPrefixId* regPrefixId =
+    face->registerPrefix("/Hello/World",
+                         bind(&FacesFixture::onRegSucceeded, this),
+                         bind(&FacesFixture::onRegFailed, this));
+
+  BOOST_REQUIRE_NO_THROW(face->processEvents(time::milliseconds(100)));
+  BOOST_CHECK_EQUAL(nRegFailures, 0);
+  BOOST_CHECK_EQUAL(nRegSuccesses, 1);
+
+  face->unregisterPrefix(regPrefixId,
+                         bind(&FacesFixture::onUnregSucceeded, this),
+                         bind(&FacesFixture::onUnregFailed, this));
+
+  BOOST_REQUIRE_NO_THROW(face->processEvents(time::milliseconds(100)));
+  BOOST_CHECK_EQUAL(nUnregFailures, 0);
+  BOOST_CHECK_EQUAL(nUnregSuccesses, 1);
+
+}
+
+BOOST_AUTO_TEST_CASE(SeTwoSimilarFilters)
+{
+  face->enableRegistrationReply();
+
+  face->setInterestFilter("/Hello/World",
+                          bind(&FacesFixture::onInterest, this, ref(*face), _1, _2),
+                          RegisterPrefixSuccessCallback(),
+                          bind(&FacesFixture::onRegFailed, this));
+
+  face->setInterestFilter("/Hello",
+                          bind(&FacesFixture::onInterest2, this, ref(*face), _1, _2),
+                          RegisterPrefixSuccessCallback(),
+                          bind(&FacesFixture::onRegFailed, this));
+
+  BOOST_REQUIRE_NO_THROW(face->processEvents(time::milliseconds(-100)));
+
+  face->receive(Interest("/Hello/World/!"));
+
+  BOOST_REQUIRE_NO_THROW(face->processEvents(time::milliseconds(-100)));
+
+  BOOST_CHECK_EQUAL(nRegFailures, 0);
+  BOOST_CHECK_EQUAL(nInInterests, 1);
+  BOOST_CHECK_EQUAL(nInInterests2, 1);
+}
+
+BOOST_AUTO_TEST_CASE(SetTwoDifferentFilters)
+{
+  face->enableRegistrationReply();
+
+  face->setInterestFilter("/Hello/World",
+                          bind(&FacesFixture::onInterest, this, ref(*face), _1, _2),
+                          RegisterPrefixSuccessCallback(),
+                          bind(&FacesFixture::onRegFailed, this));
+
+  face->setInterestFilter("/Los/Angeles/Lakers",
+                          bind(&FacesFixture::onInterest2, this, ref(*face), _1, _2),
+                          RegisterPrefixSuccessCallback(),
+                          bind(&FacesFixture::onRegFailed, this));
+
+  BOOST_REQUIRE_NO_THROW(face->processEvents(time::milliseconds(-100)));
+
+  face->receive(Interest("/Hello/World/!"));
+
+  BOOST_REQUIRE_NO_THROW(face->processEvents(time::milliseconds(-100)));
+
+  BOOST_CHECK_EQUAL(nRegFailures, 0);
+  BOOST_CHECK_EQUAL(nInInterests, 1);
+  BOOST_CHECK_EQUAL(nInInterests2, 0);
+}
+
+BOOST_AUTO_TEST_CASE(SetRegexFilterError)
+{
+  face->enableRegistrationReply();
+
+  face->setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
+                          bind(&FacesFixture::onInterestRegexError, this,
+                               ref(*face), _1, _2),
+                          RegisterPrefixSuccessCallback(),
+                          bind(&FacesFixture::onRegFailed, this));
+
+  BOOST_REQUIRE_NO_THROW(face->processEvents(time::milliseconds(-100)));
+
+  BOOST_REQUIRE_THROW(face->receive(Interest("/Hello/World/XXX/b/c")), InterestFilter::Error);
+}
+
+BOOST_AUTO_TEST_CASE(SetRegexFilter)
+{
+  face->enableRegistrationReply();
+
+  face->setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
+                          bind(&FacesFixture::onInterestRegex, this,
+                               ref(*face), _1, _2),
+                          RegisterPrefixSuccessCallback(),
+                          bind(&FacesFixture::onRegFailed, this));
+
+  BOOST_REQUIRE_NO_THROW(face->processEvents(time::milliseconds(-100)));
+
+  face->receive(Interest("/Hello/World/a"));     // shouldn't match
+  BOOST_CHECK_EQUAL(nInInterests, 0);
+
+  face->receive(Interest("/Hello/World/a/b"));   // should match
+  BOOST_CHECK_EQUAL(nInInterests, 1);
+
+  face->receive(Interest("/Hello/World/a/b/c")); // should match
+  BOOST_CHECK_EQUAL(nInInterests, 2);
+
+  face->receive(Interest("/Hello/World/a/b/d")); // should not match
+  BOOST_CHECK_EQUAL(nInInterests, 2);
+}
+
+
+BOOST_AUTO_TEST_CASE(SetRegexFilterAndRegister)
+{
+  face->enableRegistrationReply();
+
+  face->setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
+                          bind(&FacesFixture::onInterestRegex, this,
+                               ref(*face), _1, _2));
+
+  face->registerPrefix("/Hello/World",
+                       bind(&FacesFixture::onRegSucceeded, this),
+                       bind(&FacesFixture::onRegFailed, this));
+
+  BOOST_REQUIRE_NO_THROW(face->processEvents(time::milliseconds(100)));
+  BOOST_CHECK_EQUAL(nRegFailures, 0);
+  BOOST_CHECK_EQUAL(nRegSuccesses, 1);
+
+  face->receive(Interest("/Hello/World/a")); // shouldn't match
+  BOOST_CHECK_EQUAL(nInInterests, 0);
+
+  face->receive(Interest("/Hello/World/a/b")); // should match
+  BOOST_CHECK_EQUAL(nInInterests, 1);
+
+  face->receive(Interest("/Hello/World/a/b/c")); // should match
+  BOOST_CHECK_EQUAL(nInInterests, 2);
+
+  face->receive(Interest("/Hello/World/a/b/d")); // should not match
+  BOOST_CHECK_EQUAL(nInInterests, 2);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // tests
+} // namespace ndn
