diff --git a/src/validator.cpp b/src/validator.cpp
index 721b311..8bd4a4a 100644
--- a/src/validator.cpp
+++ b/src/validator.cpp
@@ -92,17 +92,14 @@
   NDNS_LOG_TRACE("[* ?? *] verify data: " << data.getName() << ". KeyLocator: "
                  << data.getSignature().getKeyLocator().getName());
   ValidatorConfig::validate(data,
-                            [this, onValidated](const shared_ptr<const Data>& data)
-                            // onValidated here cannot use reference, since this is non-block
-                            {
-                              onValidated(data);
+                            [this, onValidated] (const shared_ptr<const Data>& data) {
                               this->onDataValidated(data);
+                              onValidated(data);
                             },
-                            [this, onValidationFailed](const shared_ptr<const Data>& data,
-                                                       const std::string& str)
-                            {
-                              onValidationFailed(data, str);
+                            [this, onValidationFailed] (const shared_ptr<const Data>& data,
+                                                        const std::string& str) {
                               this->onDataValidationFailed(data, str);
+                              onValidationFailed(data, str);
                             }
                             );
 }
diff --git a/tests/unit/dummy-client-face.hpp b/tests/unit/dummy-client-face.hpp
deleted file mode 100644
index 649e714..0000000
--- a/tests/unit/dummy-client-face.hpp
+++ /dev/null
@@ -1,236 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014, Regents of the University of California.
- *
- * This file is part of NDNS (Named Data Networking Domain Name Service).
- * See AUTHORS.md for complete list of NDNS authors and contributors.
- *
- * NDNS 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.
- *
- * NDNS 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
- * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * 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.
- */
-
-#ifndef NDNS_TESTS_UNIT_DUMMY_CLIENT_FACE_HPP
-#define NDNS_TESTS_UNIT_DUMMY_CLIENT_FACE_HPP
-
-#include <ndn-cxx/face.hpp>
-#include <ndn-cxx/transport/transport.hpp>
-#include <ndn-cxx/management/nfd-controller.hpp>
-#include <ndn-cxx/management/nfd-control-response.hpp>
-#include <ndn-cxx/util/event-emitter.hpp>
-
-
-namespace ndn {
-namespace tests {
-
-class DummyClientTransport : public ndn::Transport
-{
-public:
-  void
-  receive(const Block& block)
-  {
-    if (static_cast<bool>(m_receiveCallback))
-      m_receiveCallback(block);
-  }
-
-  virtual void
-  close()
-  {
-  }
-
-  virtual void
-  pause()
-  {
-  }
-
-  virtual void
-  resume()
-  {
-  }
-
-  virtual void
-  send(const Block& wire)
-  {
-    if (wire.type() == tlv::Interest) {
-      shared_ptr<Interest> interest = make_shared<Interest>(wire);
-      (*m_onInterest)(*interest, this);
-    }
-    else if (wire.type() == tlv::Data) {
-      shared_ptr<Data> data = make_shared<Data>(wire);
-      (*m_onData)(*data, this);
-    }
-  }
-
-  virtual void
-  send(const Block& header, const Block& payload)
-  {
-    this->send(payload);
-  }
-
-  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
-{
-public:
-  explicit
-  DummyClientFace(shared_ptr<DummyClientTransport> transport)
-    : Face(transport)
-    , m_transport(transport)
-  {
-    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_onInterest = &onInterest;
-    m_transport->m_onData     = &onData;
-
-    enablePacketLogging();
-  }
-
-  /** \brief cause the Face to receive a packet
-   */
-  template<typename Packet>
-  void
-  receive(const Packet& packet)
-  {
-    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
-   *        the Interest would show up here.
-   */
-  std::vector<Interest> m_sentInterests;
-  /** \brief sent Datas
-   *  \note After .put, .processEvents must be called before
-   *        the Interest would show up here.
-   */
-  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;
-};
-
-inline shared_ptr<DummyClientFace>
-makeDummyClientFace()
-{
-  return make_shared<DummyClientFace>(make_shared<DummyClientTransport>());
-}
-
-inline shared_ptr<DummyClientFace>
-makeDummyClientFace(boost::asio::io_service& ioService)
-{
-  return make_shared<DummyClientFace>(make_shared<DummyClientTransport>(), ref(ioService));
-}
-
-
-} // namespace tests
-} // namespace ndn
-
-#endif // NDNS_TESTS_UNIT_DUMMY_CLIENT_FACE_HPP
diff --git a/tests/unit/validator.cpp b/tests/unit/validator.cpp
index 26c25ac..2525113 100644
--- a/tests/unit/validator.cpp
+++ b/tests/unit/validator.cpp
@@ -18,9 +18,10 @@
  */
 
 #include "validator.hpp"
-#include "dummy-client-face.hpp"
-#include <ndn-cxx/security/key-chain.hpp>
 #include "../boost-test.hpp"
+#include <ndn-cxx/util/dummy-client-face.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
+#include <boost/asio.hpp>
 
 namespace ndn {
 namespace ndns {
@@ -38,7 +39,7 @@
     , m_testId3("/test02/ndn/edu")
     , m_randomId("/test03")
     , m_version(name::Component::fromVersion(0))
-    , m_face(::ndn::tests::makeDummyClientFace())
+    , m_face(ndn::util::makeDummyClientFace(ndn::util::DummyClientFace::Options { false, true }))
   {
     m_keyChain.deleteIdentity(m_testId1);
     m_keyChain.deleteIdentity(m_testId2);
@@ -57,7 +58,7 @@
     m_keyChain.addCertificate(*cert);
     NDNS_LOG_TRACE("add cert: " << cert->getName() << " to KeyChain");
 
-    m_face->onInterest += bind(&Fixture::respondInterest, this, _1, _2);
+    m_face->onInterest += bind(&Fixture::respondInterest, this, _1);
   }
 
   ~Fixture()
@@ -118,7 +119,7 @@
 
 
   void
-  respondInterest(const Interest& interest, ndn::tests::DummyClientTransport* transport)
+  respondInterest(const Interest& interest)
   {
     Name certName = interest.getName();
     if (certName.isPrefixOf(m_selfSignCert)) {
@@ -130,7 +131,7 @@
     NDNS_LOG_TRACE("validator needs: " << certName);
     BOOST_CHECK_EQUAL(m_keyChain.doesCertificateExist(certName), true);
     auto cert = m_keyChain.getCertificate(certName);
-    transport->receive(cert->wireEncode());
+    m_face->receive<Data>(*cert);
   }
 
 public:
@@ -153,7 +154,7 @@
 
   name::Component m_version;
 
-  shared_ptr<ndn::tests::DummyClientFace> m_face;
+  shared_ptr<ndn::util::DummyClientFace> m_face;
 };
 
 
