diff --git a/tests/ping/client/ping.t.cpp b/tests/ping/client/ping.t.cpp
new file mode 100644
index 0000000..9f9eeb9
--- /dev/null
+++ b/tests/ping/client/ping.t.cpp
@@ -0,0 +1,121 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  Arizona Board of Regents.
+ *
+ * This file is part of ndn-tools (Named Data Networking Essential Tools).
+ * See AUTHORS.md for complete list of ndn-tools authors and contributors.
+ *
+ * ndn-tools 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.
+ *
+ * ndn-tools 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
+ * ndn-tools, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "tools/ping/client/ping.hpp"
+#include <ndn-cxx/util/dummy-client-face.hpp>
+
+#include "tests/test-common.hpp"
+
+namespace ndn {
+namespace ping {
+namespace client {
+namespace tests {
+
+using namespace ndn::tests;
+
+BOOST_AUTO_TEST_SUITE(PingClientPing)
+
+class SequenceNumberIncrementFixture : public UnitTestTimeFixture
+{
+protected:
+  SequenceNumberIncrementFixture()
+    : face(util::makeDummyClientFace(io, {false, true}))
+    , pingOptions(makeOptions())
+    , ping(*face, pingOptions)
+    , numPings(0)
+    , lastPingSeq(pingOptions.startSeq)
+  {
+    ping.afterResponse.connect(bind(&SequenceNumberIncrementFixture::onResponse, this, _1));
+    ping.afterTimeout.connect(bind(&SequenceNumberIncrementFixture::onTimeout, this, _1));
+  }
+
+public:
+  void
+  onResponse(uint64_t seq)
+  {
+    numPings++;
+    lastPingSeq = seq;
+    if (numPings == maxPings) {
+      face->shutdown();
+      io.stop();
+    }
+  }
+
+  void
+  onTimeout(uint64_t seq)
+  {
+    numPings++;
+    lastPingSeq = seq;
+    if (numPings == maxPings) {
+      face->shutdown();
+      io.stop();
+    }
+  }
+
+private:
+  static Options
+  makeOptions()
+  {
+    Options opt;
+    opt.prefix = "ndn:/test-prefix";
+    opt.shouldAllowStaleData = false;
+    opt.shouldGenerateRandomSeq = false;
+    opt.shouldPrintTimestamp = false;
+    opt.nPings = 4;
+    opt.interval = time::milliseconds(100);
+    opt.timeout = time::milliseconds(1000);
+    opt.startSeq = 1000;
+    return opt;
+  }
+
+protected:
+  boost::asio::io_service io;
+  shared_ptr<util::DummyClientFace> face;
+  Options pingOptions;
+  Ping ping;
+  uint32_t numPings;
+  uint32_t maxPings;
+  uint64_t lastPingSeq;
+  KeyChain keyChain;
+};
+
+BOOST_FIXTURE_TEST_CASE(SequenceNumberIncrement, SequenceNumberIncrementFixture)
+{
+  maxPings = 4;
+  ping.start();
+
+  this->advanceClocks(io, time::milliseconds(1), 400);
+
+  face->receive(*makeData("ndn:/test-prefix/ping/1000"));
+  face->receive(*makeData("ndn:/test-prefix/ping/1001"));
+  face->receive(*makeData("ndn:/test-prefix/ping/1002"));
+  face->receive(*makeData("ndn:/test-prefix/ping/1003"));
+
+  io.run();
+
+  BOOST_REQUIRE_EQUAL(1003, lastPingSeq);
+  BOOST_REQUIRE_EQUAL(4, numPings);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace client
+} // namespace ping
+} // namespace ndn
diff --git a/tests/ping/integrated.t.cpp b/tests/ping/integrated.t.cpp
new file mode 100644
index 0000000..f8cb30d
--- /dev/null
+++ b/tests/ping/integrated.t.cpp
@@ -0,0 +1,161 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  Arizona Board of Regents.
+ *
+ * This file is part of ndn-tools (Named Data Networking Essential Tools).
+ * See AUTHORS.md for complete list of ndn-tools authors and contributors.
+ *
+ * ndn-tools 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.
+ *
+ * ndn-tools 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
+ * ndn-tools, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "tools/ping/server/ping-server.hpp"
+#include "tools/ping/client/ping.hpp"
+#include <ndn-cxx/util/dummy-client-face.hpp>
+
+#include "tests/test-common.hpp"
+
+namespace ndn {
+namespace ping {
+namespace tests {
+
+using namespace ndn::tests;
+
+class PingIntegratedFixture : public UnitTestTimeFixture
+{
+public:
+  PingIntegratedFixture()
+    : serverFace(util::makeDummyClientFace(io, {false, true}))
+    , clientFace(util::makeDummyClientFace(io, {false, true}))
+    , numResponses(0)
+    , wantLoss(false)
+  {
+    serverFace->onSendInterest.connect([this] (const Interest& interest) {
+      io.post([=] { if (!wantLoss) { clientFace->receive(interest); } });
+    });
+    clientFace->onSendInterest.connect([this] (const Interest& interest) {
+      io.post([=] { if (!wantLoss) { serverFace->receive(interest); } });
+    });
+    serverFace->onSendData.connect([this] (const Data& data) {
+      io.post([=] { if (!wantLoss) { clientFace->receive(data); } });
+    });
+    clientFace->onSendData.connect([this] (const Data& data) {
+      io.post([=] { if (!wantLoss) { serverFace->receive(data); } });
+    });
+  }
+
+  void onTimeout(uint64_t seq)
+  {
+    numResponses++;
+    if (numResponses == maxResponses) {
+      serverFace->shutdown();
+      clientFace->shutdown();
+      io.stop();
+    }
+  }
+
+  void onData(uint64_t seq)
+  {
+    numResponses++;
+    if (numResponses == maxResponses) {
+      serverFace->shutdown();
+      clientFace->shutdown();
+      io.stop();
+    }
+  }
+
+public:
+  boost::asio::io_service io;
+  shared_ptr<util::DummyClientFace> serverFace;
+  shared_ptr<util::DummyClientFace> clientFace;
+  std::unique_ptr<server::PingServer> server;
+  std::unique_ptr<client::Ping> client;
+  int maxResponses;
+  int numResponses;
+  bool wantLoss;
+};
+
+BOOST_AUTO_TEST_SUITE(PingIntegrated)
+
+BOOST_FIXTURE_TEST_CASE(Normal, PingIntegratedFixture)
+{
+  server::Options serverOpts;
+  serverOpts.prefix = "ndn:/test-prefix";
+  serverOpts.freshnessPeriod = time::milliseconds(5000);
+  serverOpts.nMaxPings = 4;
+  serverOpts.shouldPrintTimestamp = false;
+  serverOpts.payloadSize = 0;
+  server.reset(new server::PingServer(*serverFace, serverOpts));
+  BOOST_REQUIRE_EQUAL(0, server->getNPings());
+  server->start();
+
+  client::Options clientOpts;
+  clientOpts.prefix = "ndn:/test-prefix";
+  clientOpts.shouldAllowStaleData = false;
+  clientOpts.shouldGenerateRandomSeq = false;
+  clientOpts.shouldPrintTimestamp = false;
+  clientOpts.nPings = 4;
+  clientOpts.interval = time::milliseconds(100);
+  clientOpts.timeout = time::milliseconds(2000);
+  clientOpts.startSeq = 1000;
+  client.reset(new client::Ping(*clientFace, clientOpts));
+  client->afterResponse.connect(bind(&PingIntegratedFixture::onData, this, _1));
+  client->afterTimeout.connect(bind(&PingIntegratedFixture::onTimeout, this, _1));
+  maxResponses = 4;
+  client->start();
+
+  this->advanceClocks(io, time::milliseconds(1), 400);
+  io.run();
+
+  BOOST_REQUIRE_EQUAL(4, server->getNPings());
+}
+
+BOOST_FIXTURE_TEST_CASE(Timeout, PingIntegratedFixture)
+{
+  wantLoss = true;
+
+  server::Options serverOpts;
+  serverOpts.prefix = "ndn:/test-prefix";
+  serverOpts.freshnessPeriod = time::milliseconds(5000);
+  serverOpts.nMaxPings = 4;
+  serverOpts.shouldPrintTimestamp = false;
+  serverOpts.payloadSize = 0;
+  server.reset(new server::PingServer(*serverFace, serverOpts));
+  BOOST_REQUIRE_EQUAL(0, server->getNPings());
+  server->start();
+
+  client::Options clientOpts;
+  clientOpts.prefix = "ndn:/test-prefix";
+  clientOpts.shouldAllowStaleData = false;
+  clientOpts.shouldGenerateRandomSeq = false;
+  clientOpts.shouldPrintTimestamp = false;
+  clientOpts.nPings = 4;
+  clientOpts.interval = time::milliseconds(100);
+  clientOpts.timeout = time::milliseconds(500);
+  clientOpts.startSeq = 1000;
+  client.reset(new client::Ping(*clientFace, clientOpts));
+  numResponses = 0;
+  maxResponses = 4;
+  client->afterResponse.connect(bind(&PingIntegratedFixture::onData, this, _1));
+  client->afterTimeout.connect(bind(&PingIntegratedFixture::onTimeout, this, _1));
+  client->start();
+
+  this->advanceClocks(io, time::milliseconds(1), 1000);
+  io.run();
+
+  BOOST_REQUIRE_EQUAL(0, server->getNPings());
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace ping
+} // namespace ndn
diff --git a/tests/ping/server/ping-server.t.cpp b/tests/ping/server/ping-server.t.cpp
new file mode 100644
index 0000000..874f1b2
--- /dev/null
+++ b/tests/ping/server/ping-server.t.cpp
@@ -0,0 +1,96 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  Arizona Board of Regents.
+ *
+ * This file is part of ndn-tools (Named Data Networking Essential Tools).
+ * See AUTHORS.md for complete list of ndn-tools authors and contributors.
+ *
+ * ndn-tools 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.
+ *
+ * ndn-tools 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
+ * ndn-tools, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "tools/ping/server/ping-server.hpp"
+#include <ndn-cxx/util/dummy-client-face.hpp>
+
+#include "tests/test-common.hpp"
+
+namespace ndn {
+namespace ping {
+namespace server {
+namespace tests {
+
+using namespace ndn::tests;
+
+BOOST_AUTO_TEST_SUITE(PingServerPingServer)
+
+class CreatePingServerFixture : public UnitTestTimeFixture
+{
+protected:
+  CreatePingServerFixture()
+    : face(util::makeDummyClientFace(io, {false, true}))
+    , pingOptions(makeOptions())
+    , pingServer(*face, pingOptions)
+  {
+  }
+
+  Interest
+  makePingInterest(int seq) const
+  {
+    Name name(pingOptions.prefix);
+    name.append("ping");
+    name.append(std::to_string(seq));
+    Interest interest(name);
+    interest.setMustBeFresh(true);
+    interest.setInterestLifetime(time::milliseconds(2000));
+    return interest;
+  }
+
+private:
+  static Options
+  makeOptions()
+  {
+    Options opt;
+    opt.prefix = "ndn:/test-prefix";
+    opt.freshnessPeriod = time::milliseconds(5000);
+    opt.nMaxPings = 2;
+    opt.shouldPrintTimestamp = false;
+    opt.payloadSize = 0;
+    return opt;
+  }
+
+protected:
+  boost::asio::io_service io;
+  shared_ptr<util::DummyClientFace> face;
+  Options pingOptions;
+  PingServer pingServer;
+};
+
+BOOST_FIXTURE_TEST_CASE(CreatePingServer, CreatePingServerFixture)
+{
+  BOOST_REQUIRE_EQUAL(0, pingServer.getNPings());
+  pingServer.start();
+
+  this->advanceClocks(io, time::milliseconds(1), 200);
+
+  face->receive(makePingInterest(1000));
+  face->receive(makePingInterest(1001));
+
+  io.run();
+
+  BOOST_REQUIRE_EQUAL(2, pingServer.getNPings());
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace server
+} // namespace ping
+} // namespace ndn
diff --git a/tools/ping/client/ping.cpp b/tools/ping/client/ping.cpp
index dbc2d45..8f1ba98 100644
--- a/tools/ping/client/ping.cpp
+++ b/tools/ping/client/ping.cpp
@@ -42,9 +42,15 @@
 void
 Ping::run()
 {
-  performPing();
+  start();
 
-  m_face.processEvents();
+  m_face.getIoService().run();
+}
+
+void
+Ping::start()
+{
+  performPing();
 }
 
 void
diff --git a/tools/ping/client/ping.hpp b/tools/ping/client/ping.hpp
index 9d30067..3f99fd7 100644
--- a/tools/ping/client/ping.hpp
+++ b/tools/ping/client/ping.hpp
@@ -74,11 +74,17 @@
   signal::Signal<Ping> afterFinish;
 
   /**
-   * Executes the pings
+   * Runs the ping client (blocking)
    */
   void
   run();
 
+  /**
+   * Runs the ping client (non-blocking)
+   */
+  void
+  start();
+
 private:
   /**
    * Creates a ping Name from the sequence number
diff --git a/tools/ping/server/ping-server.cpp b/tools/ping/server/ping-server.cpp
index f919113..799fa8d 100644
--- a/tools/ping/server/ping-server.cpp
+++ b/tools/ping/server/ping-server.cpp
@@ -40,14 +40,20 @@
 void
 PingServer::run()
 {
+  start();
+
+  m_face.getIoService().run();
+}
+
+void
+PingServer::start()
+{
   m_name.append("ping");
   m_face.setInterestFilter(m_name,
                            bind(&PingServer::onInterest,
                                 this, _2),
                            bind(&PingServer::onRegisterFailed,
                                 this, _2));
-
-  m_face.processEvents();
 }
 
 int
diff --git a/tools/ping/server/ping-server.hpp b/tools/ping/server/ping-server.hpp
index c5e9634..242a54a 100644
--- a/tools/ping/server/ping-server.hpp
+++ b/tools/ping/server/ping-server.hpp
@@ -65,6 +65,12 @@
   run();
 
   /**
+   * @brief starts the Interest filter
+   */
+  void
+  start();
+
+  /**
    * @brief gets the number of pings received
    */
   int
