diff --git a/tests/core/limited-io.cpp b/tests/core/limited-io.cpp
index ea19585..b381696 100644
--- a/tests/core/limited-io.cpp
+++ b/tests/core/limited-io.cpp
@@ -5,10 +5,13 @@
  */
 
 #include "limited-io.hpp"
+#include "core/logger.hpp"
 
 namespace nfd {
 namespace tests {
 
+NFD_LOG_INIT("LimitedIo");
+
 const int LimitedIo::UNLIMITED_OPS = std::numeric_limits<int>::max();
 const time::Duration LimitedIo::UNLIMITED_TIME = time::nanoseconds(-1);
 
@@ -30,7 +33,14 @@
     m_timeout = scheduler::schedule(nTimeLimit, bind(&LimitedIo::afterTimeout, this));
   }
   
-  getGlobalIoService().run();
+  try {
+    getGlobalIoService().run();
+  }
+  catch (std::exception& ex) {
+    m_reason = EXCEPTION;
+    NFD_LOG_ERROR("g_io.run() exception: " << ex.what());
+    m_lastException = ex;
+  }
   
   getGlobalIoService().reset();
   scheduler::cancel(m_timeout);
@@ -55,5 +65,11 @@
   getGlobalIoService().stop();
 }
 
+const std::exception&
+LimitedIo::getLastException() const
+{
+  return m_lastException;
+}
+
 } // namespace tests
 } // namespace nfd
diff --git a/tests/core/limited-io.hpp b/tests/core/limited-io.hpp
index 7fb4f70..0aae290 100644
--- a/tests/core/limited-io.hpp
+++ b/tests/core/limited-io.hpp
@@ -12,24 +12,41 @@
 namespace nfd {
 namespace tests {
 
+/** \brief provides IO operations limit and/or time limit for unit testing
+ */
 class LimitedIo
 {
 public:
   LimitedIo();
   
+  /// indicates why .run returns
   enum StopReason
   {
+    /// g_io.run() runs normally because there's no work to do
     NO_WORK,
+    /// .afterOp() has been invoked nOpsLimit times
     EXCEED_OPS,
-    EXCEED_TIME
+    /// nTimeLimit has elapsed
+    EXCEED_TIME,
+    /// an exception is thrown
+    EXCEPTION
   };
   
+  /** \brief g_io.run() with operation count and/or time limit
+   *
+   *  \param nOpsLimit operation count limit, pass UNLIMITED_OPS for no limit
+   *  \param nTimeLimit time limit, pass UNLIMITED_TIME for no limit
+   */
   StopReason
   run(int nOpsLimit, time::Duration nTimeLimit);
   
+  /// count an operation
   void
   afterOp();
   
+  const std::exception&
+  getLastException() const;
+  
 private:
   void
   afterTimeout();
@@ -43,6 +60,7 @@
   int m_nOpsRemaining;
   EventId m_timeout;
   StopReason m_reason;
+  std::exception m_lastException;
 };
 
 } // namespace tests
diff --git a/tests/face/tcp.cpp b/tests/face/tcp.cpp
index ff5dc50..2be6331 100644
--- a/tests/face/tcp.cpp
+++ b/tests/face/tcp.cpp
@@ -5,10 +5,10 @@
  */
 
 #include "face/tcp-factory.hpp"
-#include "core/scheduler.hpp"
 #include <ndn-cpp-dev/security/key-chain.hpp>
 
 #include "tests/test-common.hpp"
+#include "tests/core/limited-io.hpp"
 
 namespace nfd {
 namespace tests {
@@ -42,7 +42,7 @@
     m_face1->onFail +=
       bind(&EndToEndFixture::face1_onFail, this);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -50,7 +50,7 @@
   {
     BOOST_CHECK_MESSAGE(false, reason);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -58,7 +58,7 @@
   {
     m_face1_receivedInterests.push_back(interest);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -66,14 +66,14 @@
   {
     m_face1_receivedDatas.push_back(data);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
   face1_onFail()
   {
     m_face1.reset();
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -88,7 +88,7 @@
     m_face2->onFail +=
       bind(&EndToEndFixture::face2_onFail, this);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -96,7 +96,7 @@
   {
     BOOST_CHECK_MESSAGE(false, reason);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -104,7 +104,7 @@
   {
     m_face2_receivedInterests.push_back(interest);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -112,21 +112,21 @@
   {
     m_face2_receivedDatas.push_back(data);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
   face2_onFail()
   {
     m_face2.reset();
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
   channel_onFaceCreated(const shared_ptr<Face>& newFace)
   {
     m_faces.push_back(newFace);
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -134,7 +134,7 @@
   {
     BOOST_CHECK_MESSAGE(false, reason);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -143,23 +143,8 @@
     BOOST_CHECK_EQUAL(m_faces.size(), shouldBe);
   }
 
-  void
-  abortTestCase(const std::string& message)
-  {
-    g_io.stop();
-    BOOST_FAIL(message);
-  }
-
-private:
-  void
-  afterIo()
-  {
-    if (--m_ioRemaining <= 0)
-      g_io.stop();
-  }
-
 public:
-  int m_ioRemaining;
+  LimitedIo m_limitedIo;
 
   shared_ptr<Face> m_face1;
   std::vector<Interest> m_face1_receivedInterests;
@@ -176,11 +161,6 @@
 {
   TcpFactory factory;
 
-  EventId abortEvent =
-    scheduler::schedule(time::seconds(10),
-                        bind(&EndToEndFixture::abortTestCase, this,
-                             "TcpChannel error: cannot connect or cannot accept connection"));
-
   shared_ptr<TcpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
   shared_ptr<TcpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
 
@@ -192,10 +172,8 @@
                     bind(&EndToEndFixture::channel2_onConnectFailed, this, _1),
                     time::seconds(4));
 
-  m_ioRemaining = 2;
-  g_io.run();
-  g_io.reset();
-  scheduler::cancel(abortEvent);
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
+                      "TcpChannel error: cannot connect or cannot accept connection");
 
   BOOST_REQUIRE(static_cast<bool>(m_face1));
   BOOST_REQUIRE(static_cast<bool>(m_face2));
@@ -208,11 +186,6 @@
 
   // integrated tests needs to check that TcpFace for non-loopback fails these tests...
 
-  abortEvent =
-    scheduler::schedule(time::seconds(10),
-                        bind(&EndToEndFixture::abortTestCase, this,
-                             "TcpChannel error: cannot send or receive Interest/Data packets"));
-
   Interest interest1("ndn:/TpnzGvW9R");
   Data     data1    ("ndn:/KfczhUqVix");
   data1.setContent(0, 0);
@@ -232,10 +205,9 @@
   m_face2->sendInterest(interest2);
   m_face2->sendData    (data2    );
 
-  m_ioRemaining = 4;
-  g_io.run();
-  g_io.reset();
-  scheduler::cancel(abortEvent);
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(4, time::seconds(10)) == LimitedIo::EXCEED_OPS,
+                      "TcpChannel error: cannot send or receive Interest/Data packets");
+
 
   BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 1);
   BOOST_REQUIRE_EQUAL(m_face1_receivedDatas    .size(), 1);
@@ -252,11 +224,6 @@
 {
   TcpFactory factory;
 
-  EventId abortEvent =
-    scheduler::schedule(time::seconds(10),
-                        bind(&EndToEndFixture::abortTestCase, this,
-                             "TcpChannel error: cannot connect or cannot accept connection"));
-
   shared_ptr<TcpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
   shared_ptr<TcpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
 
@@ -268,10 +235,9 @@
                     bind(&EndToEndFixture::channel_onConnectFailed, this, _1),
                     time::seconds(4)); // very short timeout
 
-  m_ioRemaining = 2;
-  g_io.run();
-  g_io.reset();
-  scheduler::cancel(abortEvent);
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
+                      "TcpChannel error: cannot connect or cannot accept connection");
+
 
   BOOST_CHECK_EQUAL(m_faces.size(), 2);
 
@@ -286,30 +252,21 @@
 
   BOOST_CHECK_NE(channel3, channel4);
 
-  scheduler
-    ::schedule
-    (time::seconds(1),
-     bind(&TcpChannel::connect, channel4,
-          "127.0.0.1", "20070",
+  scheduler::schedule(time::seconds(1),
+      bind(&TcpChannel::connect, channel4, "127.0.0.1", "20070",
           // does not work without static_cast
-          static_cast<TcpChannel::FaceCreatedCallback>(bind(&EndToEndFixture::
-                                                            channel_onFaceCreated, this, _1)),
-          static_cast<TcpChannel::ConnectFailedCallback>(bind(&EndToEndFixture::
-                                                              channel_onConnectFailed, this, _1)),
-          time::seconds(4)));
-
-  m_ioRemaining = 4; // 2 connects and 2 accepts
-  abortEvent =
-    scheduler::schedule(time::seconds(10),
-                        bind(&EndToEndFixture::abortTestCase, this,
-                             "TcpChannel error: cannot connect or cannot accept multiple connections"));
+           static_cast<TcpChannel::FaceCreatedCallback>(
+               bind(&EndToEndFixture::channel_onFaceCreated, this, _1)),
+           static_cast<TcpChannel::ConnectFailedCallback>(
+               bind(&EndToEndFixture::channel_onConnectFailed, this, _1)),
+           time::seconds(4)));
 
   scheduler::schedule(time::seconds(0.5),
                       bind(&EndToEndFixture::checkFaceList, this, 4));
 
-  g_io.run();
-  g_io.reset();
-  scheduler::cancel(abortEvent);
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(4,// 2 connects and 2 accepts
+                      time::seconds(10)) == LimitedIo::EXCEED_OPS,
+                      "TcpChannel error: cannot connect or cannot accept multiple connections");
 
   BOOST_CHECK_EQUAL(m_faces.size(), 6);
 }
@@ -319,11 +276,6 @@
 {
   TcpFactory factory;
 
-  EventId abortEvent =
-    scheduler::schedule(time::seconds(10),
-                        bind(&EndToEndFixture::abortTestCase, this,
-                             "TcpChannel error: cannot connect or cannot accept connection"));
-
   shared_ptr<TcpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
   shared_ptr<TcpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
 
@@ -335,30 +287,20 @@
                     bind(&EndToEndFixture::channel2_onConnectFailed, this, _1),
                     time::seconds(4)); // very short timeout
 
-  m_ioRemaining = 2;
-  g_io.run();
-  // BOOST_REQUIRE_NO_THROW(g_io.run());
-  g_io.reset();
-  scheduler::cancel(abortEvent);
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
+                      "TcpChannel error: cannot connect or cannot accept connection");
 
   BOOST_CHECK_EQUAL(channel1->size(), 1);
   BOOST_CHECK_EQUAL(channel2->size(), 1);
 
-  abortEvent =
-    scheduler::schedule(time::seconds(10),
-                        bind(&EndToEndFixture::abortTestCase, this,
-                             "FaceClosing error: cannot properly close faces"));
-
   BOOST_REQUIRE(static_cast<bool>(m_face1));
   BOOST_CHECK(static_cast<bool>(m_face2));
 
-  m_ioRemaining = 2;
-  // just double check that we are calling the virtual method
-  static_pointer_cast<Face>(m_face1)->close();
+  // Face::close must be invoked during io run to be counted as an op
+  scheduler::schedule(time::seconds(0.1), bind(&Face::close, m_face1));
 
-  BOOST_REQUIRE_NO_THROW(g_io.run());
-  g_io.reset();
-  scheduler::cancel(abortEvent);
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
+                      "FaceClosing error: cannot properly close faces");
 
   // both faces should get closed
   BOOST_CHECK(!static_cast<bool>(m_face1));
diff --git a/tests/face/udp.cpp b/tests/face/udp.cpp
index 02c4319..12c9eb3 100644
--- a/tests/face/udp.cpp
+++ b/tests/face/udp.cpp
@@ -5,12 +5,11 @@
  */
 
 #include "face/udp-factory.hpp"
-#include "core/scheduler.hpp"
 #include "core/face-uri.hpp"
-#include "tests/test-common.hpp"
-
 #include <ndn-cpp-dev/security/key-chain.hpp>
-#include <boost/asio.hpp>
+
+#include "tests/test-common.hpp"
+#include "tests/core/limited-io.hpp"
 
 namespace nfd {
 namespace tests {
@@ -25,19 +24,19 @@
                   "Cannot create the requested UDP unicast channel, local "
                   "endpoint is already allocated for a UDP multicast face") == 0;
   }
-  
+
   bool isNotMulticastAddress(const UdpFactory::Error& e) {
     return strcmp(e.what(),
                   "Cannot create the requested UDP multicast face, "
                   "the multicast group given as input is not a multicast address") == 0;
   }
-  
+
   bool isTheSameUnicastEndpoint(const UdpFactory::Error& e) {
     return strcmp(e.what(),
                   "Cannot create the requested UDP multicast face, local "
                   "endpoint is already allocated for a UDP unicast channel") == 0;
   }
-  
+
   bool isLocalEndpointOnDifferentGroup(const UdpFactory::Error& e) {
     return strcmp(e.what(),
                   "Cannot create the requested UDP multicast face, local "
@@ -45,33 +44,33 @@
                   "on a different multicast group") == 0;
   }
 };
-  
+
 BOOST_FIXTURE_TEST_CASE(ChannelMapUdp, FactoryErrorCheck)
 {
   using boost::asio::ip::udp;
- 
+
   UdpFactory factory = UdpFactory();
-  
+
   //to instantiate multicast face on a specific ip address, change interfaceIp
   std::string interfaceIp = "0.0.0.0";
-  
+
   shared_ptr<UdpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
   shared_ptr<UdpChannel> channel1a = factory.createChannel("127.0.0.1", "20070");
   BOOST_CHECK_EQUAL(channel1, channel1a);
-  
+
   shared_ptr<UdpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
   BOOST_CHECK_NE(channel1, channel2);
 
   shared_ptr<UdpChannel> channel3 = factory.createChannel(interfaceIp, "20070");
-    
+
   //same endpoint of a unicast channel
   BOOST_CHECK_EXCEPTION(factory.createMulticastFace(interfaceIp,
                                                     "224.0.0.1",
                                                     "20070"),
                         UdpFactory::Error,
                         isTheSameUnicastEndpoint);
-    
-    
+
+
   shared_ptr<MulticastUdpFace> multicastFace1 = factory.createMulticastFace(interfaceIp,
                                                                             "224.0.0.1",
                                                                             "20072");
@@ -79,13 +78,13 @@
                                                                             "224.0.0.1",
                                                                             "20072");
   BOOST_CHECK_EQUAL(multicastFace1, multicastFace1a);
-    
-    
+
+
   //same endpoint of a multicast face
   BOOST_CHECK_EXCEPTION(factory.createChannel(interfaceIp, "20072"),
                         UdpFactory::Error,
                         isTheSameMulticastEndpoint);
-    
+
   //same multicast endpoint, different group
   BOOST_CHECK_EXCEPTION(factory.createMulticastFace(interfaceIp,
                                                     "224.0.0.42",
@@ -99,8 +98,8 @@
                         UdpFactory::Error,
                         isNotMulticastAddress);
 
-  
-  
+
+
 //  //Test commented because it required to be run in a machine that can resolve ipv6 query
 //  shared_ptr<UdpChannel> channel1v6 = factory.createChannel(//"::1",
 //                                                     "fe80::5e96:9dff:fe7d:9c8d%en1",
@@ -119,17 +118,17 @@
 //  shared_ptr<MulticastUdpFace> multicastFace3 = factory.createMulticastFace("fe80::5e96:9dff:fe7d:9c8d%en1",
 //                                                                            "FF01:0:0:0:0:0:0:2",
 //                                                                            "20073");
-//  
+//
 //  shared_ptr<MulticastUdpFace> multicastFace4 = factory.createMulticastFace("fe80::aa54:b2ff:fe08:27b8%wlan0",
 //                                                                            "FF01:0:0:0:0:0:0:2",
 //                                                                            "20073");
-//  
+//
 //  BOOST_CHECK_EQUAL(multicastFace3, multicastFace4);
 //
 //  shared_ptr<MulticastUdpFace> multicastFace5 = factory.createMulticastFace("::1",
 //                                                                            "FF01:0:0:0:0:0:0:2",
 //                                                                            "20073");
-//  
+//
 //  BOOST_CHECK_NE(multicastFace3, multicastFace5);
 //
 //  //same local ipv6 endpoint for a different multicast group
@@ -137,7 +136,7 @@
 //                                                "FE01:0:0:0:0:0:0:2",
 //                                                "20073"),
 //                    UdpFactory::Error);
-//  
+//
 //  //same local ipv6 (expect for th port number) endpoint for a different multicast group
 //  BOOST_CHECK_THROW(factory.createMulticastFace("fe80::aa54:b2ff:fe08:27b8%wlan0",
 //                                                "FE01:0:0:0:0:0:0:2",
@@ -171,13 +170,13 @@
       bind(&EndToEndFixture::face1_onReceiveInterest, this, _1);
     m_face1->onReceiveData +=
       bind(&EndToEndFixture::face1_onReceiveData, this, _1);
-    m_face1->onFail += 
+    m_face1->onFail +=
       bind(&EndToEndFixture::face1_onFail, this);
     BOOST_CHECK_MESSAGE(true, "channel 1 face created");
 
     m_faces.push_back(m_face1);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -185,30 +184,30 @@
   {
     BOOST_CHECK_MESSAGE(false, reason);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
-  
+
   void
   face1_onReceiveInterest(const Interest& interest)
   {
     m_face1_receivedInterests.push_back(interest);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
-  
+
   void
   face1_onReceiveData(const Data& data)
   {
     m_face1_receivedDatas.push_back(data);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
   face1_onFail()
   {
     m_face1.reset();
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -220,44 +219,44 @@
       bind(&EndToEndFixture::face2_onReceiveInterest, this, _1);
     m_face2->onReceiveData +=
       bind(&EndToEndFixture::face2_onReceiveData, this, _1);
-    m_face2->onFail += 
+    m_face2->onFail +=
       bind(&EndToEndFixture::face2_onFail, this);
 
     m_faces.push_back(m_face2);
 
     BOOST_CHECK_MESSAGE(true, "channel 2 face created");
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
-  
+
   void
   channel2_onConnectFailed(const std::string& reason)
   {
     BOOST_CHECK_MESSAGE(false, reason);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
-  
+
   void
   face2_onReceiveInterest(const Interest& interest)
   {
     m_face2_receivedInterests.push_back(interest);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
-  
+
   void
   face2_onReceiveData(const Data& data)
   {
     m_face2_receivedDatas.push_back(data);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
   face2_onFail()
   {
     m_face2.reset();
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -266,16 +265,16 @@
     BOOST_CHECK(!static_cast<bool>(m_face1));
     m_face3 = newFace;
     m_faces.push_back(newFace);
-    
-    this->afterIo();
+
+    m_limitedIo.afterOp();
   }
 
-  
+
   void
   channel_onFaceCreated(const shared_ptr<UdpFace>& newFace)
   {
     m_faces.push_back(newFace);
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -283,14 +282,14 @@
   {
     BOOST_CHECK_MESSAGE(false, reason);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
   channel_onConnectFailedOk(const std::string& reason)
   {
     //it's ok, it was supposed to fail
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -298,23 +297,9 @@
   {
     BOOST_CHECK_EQUAL(m_faces.size(), shouldBe);
   }
-  
-  void
-  abortTestCase(const std::string& message)
-  {
-    g_io.stop();
-    BOOST_FAIL(message);
-  }
-  
-private:
-  void
-  afterIo()
-  {
-    if (--m_ioRemaining <= 0) g_io.stop();
-  }
 
 public:
-  int m_ioRemaining;
+  LimitedIo m_limitedIo;
 
   shared_ptr<Face> m_face1;
   std::vector<Interest> m_face1_receivedInterests;
@@ -322,7 +307,7 @@
   shared_ptr<Face> m_face2;
   std::vector<Interest> m_face2_receivedInterests;
   std::vector<Data> m_face2_receivedDatas;
-  
+
   shared_ptr<Face> m_face3;
 
 
@@ -332,43 +317,29 @@
 
 BOOST_FIXTURE_TEST_CASE(EndToEnd, EndToEndFixture)
 {
-  UdpFactory factory = UdpFactory();
-  Scheduler scheduler(g_io); // to limit the amount of time the test may take
-
-  EventId abortEvent =
-    scheduler.scheduleEvent(time::seconds(1),
-                            bind(&EndToEndFixture::abortTestCase, this,
-                                 "UdpChannel error: cannot connect or cannot accept connection"));
-  
-  m_ioRemaining = 1;
+  UdpFactory factory;
 
   shared_ptr<UdpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
-  
-  
+
+
   //channel2->connect("127.0.0.1", "20070",
   //                  bind(&EndToEndFixture::channel2_onFaceCreated, this, _1),
   //                  bind(&EndToEndFixture::channel2_onConnectFailed, this, _1));
-  
+
   factory.createFace(FaceUri("udp4://127.0.0.1:20070"),
                      bind(&EndToEndFixture::channel2_onFaceCreated, this, _1),
                      bind(&EndToEndFixture::channel2_onConnectFailed, this, _1));
-  
-  
-  g_io.run();
-  g_io.reset();
-  scheduler.cancelEvent(abortEvent);
+
+
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(1, time::seconds(1)) == LimitedIo::EXCEED_OPS,
+                      "UdpChannel error: cannot connect or cannot accept connection");
 
   BOOST_REQUIRE(static_cast<bool>(m_face2));
-  
+
   shared_ptr<UdpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
   channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated,   this, _1),
                    bind(&EndToEndFixture::channel1_onConnectFailed, this, _1));
-  
-  
-  abortEvent =
-    scheduler.scheduleEvent(time::seconds(1),
-                            bind(&EndToEndFixture::abortTestCase, this,
-                                 "UdpChannel error: cannot send or receive Interest/Data packets"));
+
 
   Interest interest1("ndn:/TpnzGvW9R");
   Data     data1    ("ndn:/KfczhUqVix");
@@ -385,7 +356,7 @@
   fakeSignature.setValue(ndn::dataBlock(tlv::SignatureValue,
                                         reinterpret_cast<const uint8_t*>(0),
                                         0));
-  
+
   // set fake signature on data1 and data2
   data1.setSignature(fakeSignature);
   data2.setSignature(fakeSignature);
@@ -394,55 +365,42 @@
   m_face2->sendInterest(interest2);
   m_face2->sendData    (data2    );
 
-  m_ioRemaining = 3; //2 send + 1 listen return
-  g_io.run();
-  g_io.reset();
-  scheduler.cancelEvent(abortEvent);
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(3,//2 send + 1 listen return
+                      time::seconds(1)) == LimitedIo::EXCEED_OPS,
+                      "UdpChannel error: cannot send or receive Interest/Data packets");
 
   BOOST_REQUIRE(static_cast<bool>(m_face1));
-  
+
   m_face1->sendInterest(interest1);
   m_face1->sendData    (data1    );
-  
-  abortEvent =
-  scheduler.scheduleEvent(time::seconds(1),
-                          bind(&EndToEndFixture::abortTestCase, this,
-                               "UdpChannel error: cannot send or receive Interest/Data packets"));
-  m_ioRemaining = 2;
-  g_io.run();
-  g_io.reset();
-  scheduler.cancelEvent(abortEvent);
+
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS,
+                      "UdpChannel error: cannot send or receive Interest/Data packets");
 
 
   BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 1);
   BOOST_REQUIRE_EQUAL(m_face1_receivedDatas    .size(), 1);
   BOOST_REQUIRE_EQUAL(m_face2_receivedInterests.size(), 1);
   BOOST_REQUIRE_EQUAL(m_face2_receivedDatas    .size(), 1);
-  
+
   BOOST_CHECK_EQUAL(m_face1_receivedInterests[0].getName(), interest2.getName());
   BOOST_CHECK_EQUAL(m_face1_receivedDatas    [0].getName(), data2.getName());
   BOOST_CHECK_EQUAL(m_face2_receivedInterests[0].getName(), interest1.getName());
   BOOST_CHECK_EQUAL(m_face2_receivedDatas    [0].getName(), data1.getName());
-  
-  
-  
+
+
+
   //checking if the connection accepting mechanism works properly.
- 
+
   m_face2->sendData    (data3    );
   m_face2->sendInterest(interest3);
 
-  abortEvent =
-  scheduler.scheduleEvent(time::seconds(1),
-                          bind(&EndToEndFixture::abortTestCase, this,
-                               "UdpChannel error: cannot send or receive Interest/Data packets"));
-  m_ioRemaining = 2;
-  g_io.run();
-  g_io.reset();
-  scheduler.cancelEvent(abortEvent);
-  
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS,
+                      "UdpChannel error: cannot send or receive Interest/Data packets");
+
   BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 2);
   BOOST_REQUIRE_EQUAL(m_face1_receivedDatas    .size(), 2);
-  
+
   BOOST_CHECK_EQUAL(m_face1_receivedInterests[1].getName(), interest3.getName());
   BOOST_CHECK_EQUAL(m_face1_receivedDatas    [1].getName(), data3.getName());
 
@@ -454,95 +412,62 @@
   Interest interest2("ndn:/QWiIMfj5sL");
   Interest interest3("ndn:/QWiIhjgkj5sL");
 
-  UdpFactory factory = UdpFactory();
-  Scheduler scheduler(g_io); // to limit the amount of time the test may take
+  UdpFactory factory;
 
-  EventId abortEvent =
-    scheduler.scheduleEvent(time::seconds(4),
-                            bind(&EndToEndFixture::abortTestCase, this,
-                                 "UdpChannel error: cannot connect or cannot accept connection"));
-  
   shared_ptr<UdpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
   shared_ptr<UdpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
-  
-  
-  
+
+
+
   channel1->listen(bind(&EndToEndFixture::channel_onFaceCreated,   this, _1),
                    bind(&EndToEndFixture::channel_onConnectFailed, this, _1));
-  
+
   channel2->connect("127.0.0.1", "20070",
                     bind(&EndToEndFixture::channel2_onFaceCreated, this, _1),
                     bind(&EndToEndFixture::channel_onConnectFailed, this, _1));
-  
-  
-  m_ioRemaining = 1;
-  g_io.run();
-  g_io.reset();
-  scheduler.cancelEvent(abortEvent);
+
+
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(1, time::seconds(4)) == LimitedIo::EXCEED_OPS,
+                      "UdpChannel error: cannot connect or cannot accept connection");
 
   BOOST_CHECK_EQUAL(m_faces.size(), 1);
-  
+
   shared_ptr<UdpChannel> channel3 = factory.createChannel("127.0.0.1", "20072");
   channel3->connect("127.0.0.1", "20070",
                     bind(&EndToEndFixture::channel3_onFaceCreated, this, _1),
                     bind(&EndToEndFixture::channel_onConnectFailed, this, _1));
-  
+
   shared_ptr<UdpChannel> channel4 = factory.createChannel("127.0.0.1", "20073");
 
   BOOST_CHECK_NE(channel3, channel4);
-  
-  scheduler
-    .scheduleEvent
-    (time::seconds(0.5),
-     bind(&UdpChannel::connect, channel4,
-          "127.0.0.1", "20070",
-          // does not work without static_cast
-          static_cast<UdpChannel::FaceCreatedCallback>(bind(&EndToEndFixture::
-                                                            channel_onFaceCreated,
-                                                            this,
-                                                            _1)),
-          static_cast<UdpChannel::ConnectFailedCallback>(bind(&EndToEndFixture::
-                                                              channel_onConnectFailed,
-                                                              this,
-                                                              _1))));
-  
-  m_ioRemaining = 2; // 2 connects
-  abortEvent = 
-    scheduler.scheduleEvent(time::seconds(4),
-                            bind(&EndToEndFixture::abortTestCase, this,
-                                 "UdpChannel error: cannot connect or cannot accept multiple connections"));
 
-  scheduler.scheduleEvent(time::seconds(0.4),
-                          bind(&EndToEndFixture::checkFaceList, this, 2));
-  
-  g_io.run();
-  g_io.reset();
-  
+  scheduler::schedule(time::seconds(0.5),
+           bind(&UdpChannel::connect, channel4, "127.0.0.1", "20070",
+                // does not work without static_cast
+                static_cast<UdpChannel::FaceCreatedCallback>(
+                    bind(&EndToEndFixture::channel_onFaceCreated, this, _1)),
+                static_cast<UdpChannel::ConnectFailedCallback>(
+                    bind(&EndToEndFixture::channel_onConnectFailed, this, _1))));
+
+  scheduler::schedule(time::seconds(0.4), bind(&EndToEndFixture::checkFaceList, this, 2));
+
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(2,// 2 connects
+                      time::seconds(4)) == LimitedIo::EXCEED_OPS,
+                      "UdpChannel error: cannot connect or cannot accept multiple connections");
+
   BOOST_CHECK_EQUAL(m_faces.size(), 3);
-  
-  
+
+
   m_face2->sendInterest(interest1);
-  abortEvent =
-  scheduler.scheduleEvent(time::seconds(1),
-                          bind(&EndToEndFixture::abortTestCase, this,
-                               "UdpChannel error: cannot send or receive Interest/Data packets"));
-  m_ioRemaining = 1;
-  g_io.run();
-  g_io.reset();
-  scheduler.cancelEvent(abortEvent);
-  
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(1, time::seconds(1)) == LimitedIo::EXCEED_OPS,
+                      "UdpChannel error: cannot send or receive Interest/Data packets");
+
   BOOST_CHECK_EQUAL(m_faces.size(), 4);
-  
+
   m_face3->sendInterest(interest2);
-  abortEvent =
-  scheduler.scheduleEvent(time::seconds(1),
-                          bind(&EndToEndFixture::abortTestCase, this,
-                               "UdpChannel error: cannot send or receive Interest/Data packets"));
-  m_ioRemaining = 1;
-  g_io.run();
-  g_io.reset();
-  scheduler.cancelEvent(abortEvent);
-  
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(1, time::seconds(1)) == LimitedIo::EXCEED_OPS,
+                      "UdpChannel error: cannot send or receive Interest/Data packets");
+
   //channel1 should have created 2 faces, one when m_face2 sent an interest, one when m_face3 sent an interest
   BOOST_CHECK_EQUAL(m_faces.size(), 5);
   BOOST_CHECK_THROW(channel1->listen(bind(&EndToEndFixture::channel_onFaceCreated,
@@ -553,40 +478,40 @@
                                          _1)),
                     UdpChannel::Error);
 }
-  
+
 //Test commented because it required to be run in a machine that can resolve ipv6 query
 //BOOST_FIXTURE_TEST_CASE(EndToEndIpv6, EndToEndFixture)
 //{
 //  UdpFactory factory = UdpFactory();
 //  Scheduler scheduler(g_io); // to limit the amount of time the test may take
-//    
+//
 //  EventId abortEvent =
 //  scheduler.scheduleEvent(time::seconds(1),
 //                          bind(&EndToEndFixture::abortTestCase, this,
 //                              "UdpChannel error: cannot connect or cannot accept connection"));
-//    
-//  m_ioRemaining = 1;
-//    
+//
+//  m_limitedIoRemaining = 1;
+//
 //  shared_ptr<UdpChannel> channel1 = factory.createChannel("::1", "20070");
 //  shared_ptr<UdpChannel> channel2 = factory.createChannel("::1", "20071");
-//    
+//
 //  channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated,   this, _1),
 //                   bind(&EndToEndFixture::channel1_onConnectFailed, this, _1));
-//    
+//
 //  channel2->connect("::1", "20070",
 //                    bind(&EndToEndFixture::channel2_onFaceCreated, this, _1),
 //                    bind(&EndToEndFixture::channel2_onConnectFailed, this, _1));
 //  g_io.run();
 //  g_io.reset();
 //  scheduler.cancelEvent(abortEvent);
-//    
+//
 //  BOOST_REQUIRE(static_cast<bool>(m_face2));
-//    
+//
 //  abortEvent =
 //  scheduler.scheduleEvent(time::seconds(1),
 //                          bind(&EndToEndFixture::abortTestCase, this,
 //                               "UdpChannel error: cannot send or receive Interest/Data packets"));
-//    
+//
 //  Interest interest1("ndn:/TpnzGvW9R");
 //  Data     data1    ("ndn:/KfczhUqVix");
 //  data1.setContent(0, 0);
@@ -596,67 +521,67 @@
 //  Interest interest3("ndn:/QWiIhjgkj5sL");
 //  Data     data3    ("ndn:/XNBV794f");
 //  data3.setContent(0, 0);
-//  
+//
 //  ndn::SignatureSha256WithRsa fakeSignature;
 //  fakeSignature.setValue(ndn::dataBlock(tlv::SignatureValue, reinterpret_cast<const uint8_t*>(0), 0));
-//    
+//
 //  // set fake signature on data1 and data2
 //  data1.setSignature(fakeSignature);
 //  data2.setSignature(fakeSignature);
 //  data3.setSignature(fakeSignature);
-//    
+//
 //  m_face2->sendInterest(interest2);
 //  m_face2->sendData    (data2    );
-//    
-//  m_ioRemaining = 3; //2 send + 1 listen return
+//
+//  m_limitedIoRemaining = 3; //2 send + 1 listen return
 //  g_io.run();
 //  g_io.reset();
 //  scheduler.cancelEvent(abortEvent);
-//    
+//
 //  BOOST_REQUIRE(static_cast<bool>(m_face1));
-//    
+//
 //  m_face1->sendInterest(interest1);
 //  m_face1->sendData    (data1    );
-//  
+//
 //  abortEvent =
 //  scheduler.scheduleEvent(time::seconds(1),
 //                          bind(&EndToEndFixture::abortTestCase, this,
 //                               "UdpChannel error: cannot send or receive Interest/Data packets"));
-//  m_ioRemaining = 2;
+//  m_limitedIoRemaining = 2;
 //  g_io.run();
 //  g_io.reset();
 //  scheduler.cancelEvent(abortEvent);
-//  
+//
 //  BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 1);
 //  BOOST_REQUIRE_EQUAL(m_face1_receivedDatas    .size(), 1);
 //  BOOST_REQUIRE_EQUAL(m_face2_receivedInterests.size(), 1);
 //  BOOST_REQUIRE_EQUAL(m_face2_receivedDatas    .size(), 1);
-//    
+//
 //  BOOST_CHECK_EQUAL(m_face1_receivedInterests[0].getName(), interest2.getName());
 //  BOOST_CHECK_EQUAL(m_face1_receivedDatas    [0].getName(), data2.getName());
 //  BOOST_CHECK_EQUAL(m_face2_receivedInterests[0].getName(), interest1.getName());
 //  BOOST_CHECK_EQUAL(m_face2_receivedDatas    [0].getName(), data1.getName());
-//    
+//
 //  //checking if the connection accepting mechanism works properly.
-//    
+//
 //  m_face2->sendData    (data3    );
 //  m_face2->sendInterest(interest3);
-//    
+//
 //  abortEvent =
 //  scheduler.scheduleEvent(time::seconds(1),
 //                          bind(&EndToEndFixture::abortTestCase, this,
 //                               "UdpChannel error: cannot send or receive Interest/Data packets"));
-//  m_ioRemaining = 2;
+//  m_limitedIoRemaining = 2;
 //  g_io.run();
 //  g_io.reset();
 //  scheduler.cancelEvent(abortEvent);
-//    
+//
 //  BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 2);
 //  BOOST_REQUIRE_EQUAL(m_face1_receivedDatas    .size(), 2);
-//    
+//
 //  BOOST_CHECK_EQUAL(m_face1_receivedInterests[1].getName(), interest3.getName());
 //  BOOST_CHECK_EQUAL(m_face1_receivedDatas    [1].getName(), data3.getName());
-//    
+//
 //}
 
 
@@ -666,41 +591,41 @@
 //  Interest interest1("ndn:/TpnzGvW9R");
 //  Interest interest2("ndn:/QWiIMfj5sL");
 //  Interest interest3("ndn:/QWiIhjgkj5sL");
-//    
+//
 //  UdpFactory factory = UdpFactory();
 //  Scheduler scheduler(g_io); // to limit the amount of time the test may take
-//    
+//
 //  EventId abortEvent =
 //  scheduler.scheduleEvent(time::seconds(4),
 //                          bind(&EndToEndFixture::abortTestCase, this,
 //                               "UdpChannel error: cannot connect or cannot accept connection"));
-//    
+//
 //  shared_ptr<UdpChannel> channel1 = factory.createChannel("::1", "20070");
 //  shared_ptr<UdpChannel> channel2 = factory.createChannel("::1", "20071");
-//    
+//
 //  channel1->listen(bind(&EndToEndFixture::channel_onFaceCreated,   this, _1),
 //                   bind(&EndToEndFixture::channel_onConnectFailed, this, _1));
-//    
+//
 //  channel2->connect("::1", "20070",
 //                    bind(&EndToEndFixture::channel2_onFaceCreated, this, _1),
 //                    bind(&EndToEndFixture::channel_onConnectFailed, this, _1));
-//    
-//  m_ioRemaining = 1;
+//
+//  m_limitedIoRemaining = 1;
 //  g_io.run();
 //  g_io.reset();
 //  scheduler.cancelEvent(abortEvent);
-//    
+//
 //  BOOST_CHECK_EQUAL(m_faces.size(), 1);
-//    
+//
 //  shared_ptr<UdpChannel> channel3 = factory.createChannel("::1", "20072");
 //  channel3->connect("::1", "20070",
 //                    bind(&EndToEndFixture::channel3_onFaceCreated, this, _1),
 //                    bind(&EndToEndFixture::channel_onConnectFailed, this, _1));
-//    
+//
 //  shared_ptr<UdpChannel> channel4 = factory.createChannel("::1", "20073");
-//    
+//
 //  BOOST_CHECK_NE(channel3, channel4);
-//    
+//
 //  scheduler
 //  .scheduleEvent(time::seconds(0.5),
 //                 bind(&UdpChannel::connect, channel4,
@@ -709,44 +634,44 @@
 //                                                                        channel_onFaceCreated, this, _1)),
 //                      static_cast<UdpChannel::ConnectFailedCallback>(bind(&EndToEndFixture::
 //                                                                          channel_onConnectFailed, this, _1))));
-//    
-//  m_ioRemaining = 2; // 2 connects
+//
+//  m_limitedIoRemaining = 2; // 2 connects
 //  abortEvent =
 //  scheduler.scheduleEvent(time::seconds(4),
 //                          bind(&EndToEndFixture::abortTestCase, this,
 //                               "UdpChannel error: cannot connect or cannot accept multiple connections"));
-//    
+//
 //  scheduler.scheduleEvent(time::seconds(0.4),
 //                          bind(&EndToEndFixture::checkFaceList, this, 2));
-//    
+//
 //  g_io.run();
 //  g_io.reset();
-//    
+//
 //  BOOST_CHECK_EQUAL(m_faces.size(), 3);
-//    
-//    
+//
+//
 //  m_face2->sendInterest(interest1);
 //  abortEvent =
 //  scheduler.scheduleEvent(time::seconds(1),
 //                          bind(&EndToEndFixture::abortTestCase, this,
 //                               "UdpChannel error: cannot send or receive Interest/Data packets"));
-//  m_ioRemaining = 1;
+//  m_limitedIoRemaining = 1;
 //  g_io.run();
 //  g_io.reset();
 //  scheduler.cancelEvent(abortEvent);
-//    
+//
 //  BOOST_CHECK_EQUAL(m_faces.size(), 4);
-//    
+//
 //  m_face3->sendInterest(interest2);
 //  abortEvent =
 //  scheduler.scheduleEvent(time::seconds(1),
 //                          bind(&EndToEndFixture::abortTestCase, this,
 //                               "UdpChannel error: cannot send or receive Interest/Data packets"));
-//  m_ioRemaining = 1;
+//  m_limitedIoRemaining = 1;
 //  g_io.run();
 //  g_io.reset();
 //  scheduler.cancelEvent(abortEvent);
-//    
+//
 //  //channel1 should have created 2 faces, one when m_face2 sent an interest, one when m_face3 sent an interest
 //  BOOST_CHECK_EQUAL(m_faces.size(), 5);
 //  BOOST_CHECK_THROW(channel1->listen(bind(&EndToEndFixture::channel_onFaceCreated,
@@ -762,47 +687,32 @@
 BOOST_FIXTURE_TEST_CASE(FaceClosing, EndToEndFixture)
 {
   UdpFactory factory = UdpFactory();
-  Scheduler scheduler(g_io); // to limit the amount of time the test may take
 
-  EventId abortEvent =
-    scheduler.scheduleEvent(time::seconds(4),
-                            bind(&EndToEndFixture::abortTestCase, this,
-                                 "UdpChannel error: cannot connect or cannot accept connection"));
-  
   shared_ptr<UdpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
   shared_ptr<UdpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
-  
+
   channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated,   this, _1),
                    bind(&EndToEndFixture::channel1_onConnectFailed, this, _1));
-  
+
   channel2->connect("127.0.0.1", "20070",
                     bind(&EndToEndFixture::channel2_onFaceCreated, this, _1),
                     bind(&EndToEndFixture::channel2_onConnectFailed, this, _1));
-  
-  m_ioRemaining = 1;
-  BOOST_REQUIRE_NO_THROW(g_io.run());
-  g_io.reset();
-  scheduler.cancelEvent(abortEvent);
+
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(1, time::seconds(4)) == LimitedIo::EXCEED_OPS,
+                      "UdpChannel error: cannot connect or cannot accept connection");
 
   BOOST_CHECK_EQUAL(channel2->size(), 1);
 
-  abortEvent =
-    scheduler.scheduleEvent(time::seconds(4),
-                            bind(&EndToEndFixture::abortTestCase, this,
-                                 "FaceClosing error: cannot properly close faces"));
-
   BOOST_CHECK(static_cast<bool>(m_face2));
 
-  m_ioRemaining = 1;
-  // just double check that we are calling the virtual method
-  static_pointer_cast<Face>(m_face2)->close();
-  
-  BOOST_REQUIRE_NO_THROW(g_io.run());
-  g_io.reset();
-  scheduler.cancelEvent(abortEvent);
+  // Face::close must be invoked during io run to be counted as an op
+  scheduler::schedule(time::seconds(0.1), bind(&Face::close, m_face2));
+
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(1, time::seconds(4)) == LimitedIo::EXCEED_OPS,
+                      "FaceClosing error: cannot properly close faces");
 
   BOOST_CHECK(!static_cast<bool>(m_face2));
-  
+
   BOOST_CHECK_EQUAL(channel2->size(), 0);
 }
 
@@ -810,23 +720,23 @@
 //{
 //  //to instantiate multicast face on a specific ip address, change interfaceIp
 //  std::string interfaceIp = "0.0.0.0";
-//  
+//
 //  UdpFactory factory = UdpFactory();
 //  Scheduler scheduler(g_io); // to limit the amount of time the test may take
-//  
+//
 //  shared_ptr<MulticastUdpFace> multicastFace1 =
 //    factory.createMulticastFace(interfaceIp, "224.0.0.1", "20072");
-//  
+//
 //  BOOST_REQUIRE(static_cast<bool>(multicastFace1));
-//  
+//
 //  channel1_onFaceCreated(multicastFace1);
 //
-//  
+//
 //  EventId abortEvent =
 //  scheduler.scheduleEvent(time::seconds(10),
 //                          bind(&EndToEndFixture::abortTestCase, this,
 //                               "MulticastFace error: cannot send or receive Interest/Data packets"));
-//  
+//
 //  Interest interest1("ndn:/TpnzGvW9R");
 //  Data     data1    ("ndn:/KfczhUqVix");
 //  data1.setContent(0, 0);
@@ -836,34 +746,35 @@
 //  Interest interest3("ndn:/QWiIhjgkj5sL");
 //  Data     data3    ("ndn:/XNBV794f");
 //  data3.setContent(0, 0);
-//  
-//  
+//
+//
 //  ndn::SignatureSha256WithRsa fakeSignature;
 //  fakeSignature.setValue(ndn::dataBlock(tlv::SignatureValue, reinterpret_cast<const uint8_t*>(0), 0));
-//  
+//
 //  // set fake signature on data1 and data2
 //  data1.setSignature(fakeSignature);
 //  data2.setSignature(fakeSignature);
 //  data3.setSignature(fakeSignature);
-//  
+//
 //  multicastFace1->sendInterest(interest1);
 //  multicastFace1->sendData    (data1    );
-//  
+//
 //  g_io.reset();
-//  m_ioRemaining = 2;
+//  m_limitedIoRemaining = 2;
 //  g_io.run();
 //  g_io.reset();
 //  scheduler.cancelEvent(abortEvent);
-//  
+//
 //  BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 1);
 //  BOOST_REQUIRE_EQUAL(m_face1_receivedDatas    .size(), 1);
-//  
+//
 //  BOOST_CHECK_EQUAL(m_face1_receivedInterests[0].getName(), interest1.getName());
 //  BOOST_CHECK_EQUAL(m_face1_receivedDatas    [0].getName(), data1.getName());
 //}
 
-  
-  
+
+
 BOOST_AUTO_TEST_SUITE_END()
+
 } // namespace tests
 } // namespace nfd
diff --git a/tests/face/unix-stream.cpp b/tests/face/unix-stream.cpp
index beed83e..d143251 100644
--- a/tests/face/unix-stream.cpp
+++ b/tests/face/unix-stream.cpp
@@ -5,10 +5,10 @@
  */
 
 #include "face/unix-stream-factory.hpp"
-#include "core/scheduler.hpp"
 #include <ndn-cpp-dev/security/key-chain.hpp>
 
 #include "tests/test-common.hpp"
+#include "tests/core/limited-io.hpp"
 
 namespace nfd {
 namespace tests {
@@ -37,7 +37,7 @@
   {
     BOOST_CHECK_MESSAGE(!error, error.message());
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -50,7 +50,7 @@
     m_face1->onReceiveData +=
       bind(&EndToEndFixture::face1_onReceiveData, this, _1);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -58,7 +58,7 @@
   {
     BOOST_CHECK_MESSAGE(false, reason);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -66,7 +66,7 @@
   {
     m_face1_receivedInterests.push_back(interest);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -74,7 +74,7 @@
   {
     m_face1_receivedDatas.push_back(data);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -82,7 +82,7 @@
   {
     m_face2_receivedInterests.push_back(interest);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -90,7 +90,7 @@
   {
     m_face2_receivedDatas.push_back(data);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -98,7 +98,7 @@
   {
     m_faces.push_back(newFace);
 
-    this->afterIo();
+    m_limitedIo.afterOp();
   }
 
   void
@@ -106,26 +106,11 @@
   {
     BOOST_CHECK_MESSAGE(false, reason);
 
-    this->afterIo();
-  }
-
-  void
-  abortTestCase(const std::string& message)
-  {
-    g_io.stop();
-    BOOST_FAIL(message);
-  }
-
-private:
-  void
-  afterIo()
-  {
-    if (--m_ioRemaining <= 0)
-      g_io.stop();
+    m_limitedIo.afterOp();
   }
 
 protected:
-  int m_ioRemaining;
+  LimitedIo m_limitedIo;
 
   shared_ptr<UnixStreamFace> m_face1;
   std::vector<Interest> m_face1_receivedInterests;
@@ -142,11 +127,6 @@
 {
   UnixStreamFactory factory;
 
-  EventId abortEvent =
-    scheduler::schedule(time::seconds(1),
-                        bind(&EndToEndFixture::abortTestCase, this,
-                             "UnixStreamChannel error: cannot connect or cannot accept connection"));
-
   shared_ptr<UnixStreamChannel> channel1 = factory.createChannel("foo");
   channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated,   this, _1),
                    bind(&EndToEndFixture::channel1_onConnectFailed, this, _1));
@@ -156,18 +136,11 @@
   client->async_connect(stream_protocol::endpoint("foo"),
                         bind(&EndToEndFixture::client_onConnect, this, _1));
 
-  m_ioRemaining = 2;
-  g_io.run();
-  g_io.reset();
-  scheduler::cancel(abortEvent);
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS,
+                      "UnixStreamChannel error: cannot connect or cannot accept connection");
 
   BOOST_REQUIRE(static_cast<bool>(m_face1));
 
-  abortEvent =
-    scheduler::schedule(time::seconds(1),
-                        bind(&EndToEndFixture::abortTestCase, this,
-                             "UnixStreamChannel error: cannot send or receive Interest/Data packets"));
-
   m_face2 = make_shared<UnixStreamFace>(client);
   m_face2->onReceiveInterest +=
     bind(&EndToEndFixture::face2_onReceiveInterest, this, _1);
@@ -193,9 +166,8 @@
   m_face2->sendInterest(interest2);
   m_face2->sendData    (data2    );
 
-  m_ioRemaining = 4;
-  g_io.run();
-  g_io.reset();
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(4, time::seconds(1)) == LimitedIo::EXCEED_OPS,
+                      "UnixStreamChannel error: cannot send or receive Interest/Data packets");
 
   BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 1);
   BOOST_REQUIRE_EQUAL(m_face1_receivedDatas    .size(), 1);
@@ -212,11 +184,6 @@
 {
   UnixStreamFactory factory;
 
-  EventId abortEvent =
-    scheduler::schedule(time::seconds(1),
-                        bind(&EndToEndFixture::abortTestCase, this,
-                             "UnixStreamChannel error: cannot connect or cannot accept connection"));
-
   shared_ptr<UnixStreamChannel> channel = factory.createChannel("foo");
   channel->listen(bind(&EndToEndFixture::channel_onFaceCreated,   this, _1),
                   bind(&EndToEndFixture::channel_onConnectFailed, this, _1));
@@ -226,27 +193,18 @@
   client1->async_connect(stream_protocol::endpoint("foo"),
                          bind(&EndToEndFixture::client_onConnect, this, _1));
 
-  m_ioRemaining = 2;
-  g_io.run();
-  g_io.reset();
-  scheduler::cancel(abortEvent);
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS,
+                      "UnixStreamChannel error: cannot connect or cannot accept connection");
 
   BOOST_CHECK_EQUAL(m_faces.size(), 1);
 
-  abortEvent =
-    scheduler::schedule(time::seconds(1),
-                        bind(&EndToEndFixture::abortTestCase, this,
-                             "UnixStreamChannel error: cannot accept multiple connections"));
-
   shared_ptr<stream_protocol::socket> client2 =
       make_shared<stream_protocol::socket>(boost::ref(g_io));
   client2->async_connect(stream_protocol::endpoint("foo"),
                          bind(&EndToEndFixture::client_onConnect, this, _1));
 
-  m_ioRemaining = 2;
-  g_io.run();
-  g_io.reset();
-  scheduler::cancel(abortEvent);
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS,
+                      "UnixStreamChannel error: cannot accept multiple connections");
 
   BOOST_CHECK_EQUAL(m_faces.size(), 2);
 
@@ -266,11 +224,6 @@
   m_face2->onReceiveData +=
       bind(&EndToEndFixture::face2_onReceiveData, this, _1);
 
-  abortEvent =
-    scheduler::schedule(time::seconds(1),
-                        bind(&EndToEndFixture::abortTestCase, this,
-                             "UnixStreamChannel error: cannot send or receive Interest/Data packets"));
-
   Interest interest1("ndn:/TpnzGvW9R");
   Data     data1    ("ndn:/KfczhUqVix");
   data1.setContent(0, 0);
@@ -290,9 +243,8 @@
   m_face2->sendInterest(interest2);
   m_face2->sendData    (data2    );
 
-  m_ioRemaining = 4;
-  g_io.run();
-  g_io.reset();
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(4, time::seconds(1)) == LimitedIo::EXCEED_OPS,
+                      "UnixStreamChannel error: cannot send or receive Interest/Data packets");
 
   BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 1);
   BOOST_REQUIRE_EQUAL(m_face1_receivedDatas    .size(), 1);
@@ -314,11 +266,6 @@
 {
   UnixStreamFactory factory;
 
-  EventId abortEvent =
-    scheduler::schedule(time::seconds(1),
-                        bind(&EndToEndFixture::abortTestCase, this,
-                             "UnixStreamChannel error: cannot connect or cannot accept connection"));
-
   shared_ptr<UnixStreamChannel> channel1 = factory.createChannel("foo");
   channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated,   this, _1),
                    bind(&EndToEndFixture::channel1_onConnectFailed, this, _1));
@@ -328,18 +275,11 @@
   client->async_connect(stream_protocol::endpoint("foo"),
                         bind(&EndToEndFixture::client_onConnect, this, _1));
 
-  m_ioRemaining = 2;
-  g_io.run();
-  g_io.reset();
-  scheduler::cancel(abortEvent);
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS,
+                      "UnixStreamChannel error: cannot connect or cannot accept connection");
 
   BOOST_REQUIRE(static_cast<bool>(m_face1));
 
-  abortEvent =
-    scheduler::schedule(time::seconds(1),
-                        bind(&EndToEndFixture::abortTestCase, this,
-                             "UnixStreamChannel error: cannot send or receive Interest/Data packets"));
-
   m_face2 = make_shared<UnixStreamFace>(client);
   m_face2->onReceiveInterest +=
     bind(&EndToEndFixture::face2_onReceiveInterest, this, _1);
@@ -386,9 +326,8 @@
 
   //
 
-  m_ioRemaining = 2;
-  g_io.run();
-  g_io.reset();
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS,
+                      "UnixStreamChannel error: cannot send or receive Interest/Data packets");
 
   BOOST_REQUIRE_EQUAL(m_face2_receivedInterests.size(), 1);
   BOOST_REQUIRE_EQUAL(m_face2_receivedDatas    .size(), 1);
@@ -421,9 +360,8 @@
   client->async_send(interestWithHeader, bind(&noOp));
   client->async_send(dataWithHeader, bind(&noOp));
 
-  m_ioRemaining = 2;
-  g_io.run();
-  g_io.reset();
+  BOOST_CHECK_MESSAGE(m_limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS,
+                      "UnixStreamChannel error: cannot send or receive Interest/Data packets");
 
   BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 1);
   BOOST_REQUIRE_EQUAL(m_face1_receivedDatas    .size(), 1);
