diff --git a/daemon/face/channel-factory.hpp b/daemon/face/channel-factory.hpp
index 184703a..566063b 100644
--- a/daemon/face/channel-factory.hpp
+++ b/daemon/face/channel-factory.hpp
@@ -11,16 +11,9 @@
 
 namespace nfd {
 
-/**
- * \brief Base class for all channel factories
- */
-template<class E, class C>
 class ChannelFactory
 {
 public:
-  typedef E Endpoint;
-  typedef C Channel;
-  
   /**
    * \brief Base class for all exceptions thrown by channel factories
    */
@@ -29,9 +22,6 @@
     Error(const std::string& what) : std::runtime_error(what) {}
   };
 
-protected:
-  typedef std::map< Endpoint, shared_ptr<Channel> > ChannelMap;
-  ChannelMap m_channels;  
 };
 
 } // namespace nfd
diff --git a/daemon/face/ethernet-channel-factory.hpp b/daemon/face/ethernet-channel-factory.hpp
index 4f655bd..a9094af 100644
--- a/daemon/face/ethernet-channel-factory.hpp
+++ b/daemon/face/ethernet-channel-factory.hpp
@@ -8,18 +8,19 @@
 #define NFD_FACE_ETHERNET_CHANNEL_FACTORY_HPP
 
 #include "ethernet-face.hpp"
+#include "channel-factory.hpp"
 
 namespace nfd {
 
-class EthernetChannelFactory
+class EthernetChannelFactory : public ChannelFactory
 {
 public:
   /**
    * \brief Exception of EthernetChannelFactory
    */
-  struct Error : public std::runtime_error
+  struct Error : public ChannelFactory::Error
   {
-    Error(const std::string& what) : std::runtime_error(what) {}
+    Error(const std::string& what) : ChannelFactory::Error(what) {}
   };
 
   /**
diff --git a/daemon/face/tcp-channel-factory.cpp b/daemon/face/tcp-channel-factory.cpp
index be3a9d4..3a75183 100644
--- a/daemon/face/tcp-channel-factory.cpp
+++ b/daemon/face/tcp-channel-factory.cpp
@@ -5,14 +5,10 @@
  */
 
 #include "tcp-channel-factory.hpp"
+#include "core/global-io.hpp"
 
 namespace nfd {
 
-TcpChannelFactory::TcpChannelFactory(boost::asio::io_service& ioService)
-  : m_ioService(ioService)
-{
-}
-
 shared_ptr<TcpChannel>
 TcpChannelFactory::create(const tcp::Endpoint& endpoint)
 {
@@ -20,7 +16,7 @@
   if(static_cast<bool>(channel))
     return channel;
 
-  channel = make_shared<TcpChannel>(boost::ref(m_ioService), boost::cref(endpoint));
+  channel = make_shared<TcpChannel>(boost::ref(getGlobalIoService()), boost::cref(endpoint));
   m_channels[endpoint] = channel;
   return channel;
 }
@@ -29,11 +25,9 @@
 TcpChannelFactory::create(const std::string& localHost, const std::string& localPort)
 {
   using boost::asio::ip::tcp;
-  
+
   tcp::resolver::query query(localHost, localPort);
-  // shared_ptr<tcp::resolver> resolver =
-  //   make_shared<tcp::resolver>(boost::ref(m_ioService));
-  tcp::resolver resolver(m_ioService);
+  tcp::resolver resolver(getGlobalIoService());
 
   tcp::resolver::iterator end;
   tcp::resolver::iterator i = resolver.resolve(query);
diff --git a/daemon/face/tcp-channel-factory.hpp b/daemon/face/tcp-channel-factory.hpp
index 171c24f..c87cdf4 100644
--- a/daemon/face/tcp-channel-factory.hpp
+++ b/daemon/face/tcp-channel-factory.hpp
@@ -12,23 +12,17 @@
 
 namespace nfd {
 
-class TcpChannelFactory : public ChannelFactory<tcp::Endpoint, TcpChannel>
+class TcpChannelFactory : public ChannelFactory
 {
 public:
   /**
    * \brief Exception of TcpChannelFactory
    */
-  struct Error : public ChannelFactory<tcp::Endpoint, TcpChannel>::Error
+  struct Error : public ChannelFactory::Error
   {
-    Error(const std::string& what)
-      : ChannelFactory<tcp::Endpoint, TcpChannel>::Error(what)
-    {
-    }
+    Error(const std::string& what) : ChannelFactory::Error(what) {}
   };
 
-  explicit
-  TcpChannelFactory(boost::asio::io_service& ioService);
-
   /**
    * \brief Create TCP-based channel using tcp::Endpoint
    *
@@ -67,7 +61,7 @@
    * \brief Look up TcpChannel using specified local endpoint
    *
    * \returns shared pointer to the existing TcpChannel object
-   *          or empty shared pointer when such channel does not exist 
+   *          or empty shared pointer when such channel does not exist
    *
    * \throws never
    */
@@ -75,7 +69,8 @@
   find(const tcp::Endpoint& localEndpoint);
 
 private:
-  boost::asio::io_service& m_ioService;
+  typedef std::map< tcp::Endpoint, shared_ptr<TcpChannel> > ChannelMap;
+  ChannelMap m_channels;
 };
 
 } // namespace nfd
diff --git a/daemon/face/unix-stream-channel-factory.cpp b/daemon/face/unix-stream-channel-factory.cpp
index ededecd..040c1e2 100644
--- a/daemon/face/unix-stream-channel-factory.cpp
+++ b/daemon/face/unix-stream-channel-factory.cpp
@@ -5,13 +5,13 @@
  */
 
 #include "unix-stream-channel-factory.hpp"
+#include "core/global-io.hpp"
 
 #include <boost/filesystem.hpp> // for canonical()
 
 namespace nfd {
 
-UnixStreamChannelFactory::UnixStreamChannelFactory(boost::asio::io_service& ioService)
-  : m_ioService(ioService)
+UnixStreamChannelFactory::UnixStreamChannelFactory()
 {
 }
 
@@ -26,7 +26,7 @@
   if (channel)
     return channel;
 
-  channel = make_shared<UnixStreamChannel>(boost::ref(m_ioService),
+  channel = make_shared<UnixStreamChannel>(boost::ref(getGlobalIoService()),
                                            boost::cref(endpoint));
   m_channels[endpoint] = channel;
   return channel;
diff --git a/daemon/face/unix-stream-channel-factory.hpp b/daemon/face/unix-stream-channel-factory.hpp
index 8d0a6e7..bf14117 100644
--- a/daemon/face/unix-stream-channel-factory.hpp
+++ b/daemon/face/unix-stream-channel-factory.hpp
@@ -12,22 +12,19 @@
 
 namespace nfd {
 
-class UnixStreamChannelFactory : public ChannelFactory<unix_stream::Endpoint, UnixStreamChannel>
+class UnixStreamChannelFactory : public ChannelFactory
 {
 public:
   /**
    * \brief Exception of UnixStreamChannelFactory
    */
-  struct Error : public ChannelFactory<unix_stream::Endpoint, UnixStreamChannel>::Error
+  struct Error : public ChannelFactory::Error
   {
-    Error(const std::string& what)
-      : ChannelFactory<unix_stream::Endpoint, UnixStreamChannel>::Error(what)
-    {
-    }
+    Error(const std::string& what) : ChannelFactory::Error(what) {}
   };
 
   explicit
-  UnixStreamChannelFactory(boost::asio::io_service& ioService);
+  UnixStreamChannelFactory();
 
   /**
    * \brief Create stream-oriented Unix channel using specified socket path
@@ -57,7 +54,8 @@
   find(const unix_stream::Endpoint& endpoint);
 
 private:
-  boost::asio::io_service& m_ioService;
+  typedef std::map< unix_stream::Endpoint, shared_ptr<UnixStreamChannel> > ChannelMap;
+  ChannelMap m_channels;
 };
 
 } // namespace nfd
diff --git a/daemon/main.cpp b/daemon/main.cpp
index 2c83177..b8165f8 100644
--- a/daemon/main.cpp
+++ b/daemon/main.cpp
@@ -171,7 +171,7 @@
 void
 initializeTcp()
 {
-  g_tcpFactory = new TcpChannelFactory(getGlobalIoService());
+  g_tcpFactory = new TcpChannelFactory();
   g_tcpChannel = g_tcpFactory->create(g_options.m_tcpListen.first,
                                       g_options.m_tcpListen.second);
   g_tcpChannel->listen(
@@ -190,7 +190,7 @@
 void
 initializeUnix()
 {
-  g_unixFactory = new UnixStreamChannelFactory(getGlobalIoService());
+  g_unixFactory = new UnixStreamChannelFactory();
   g_unixChannel = g_unixFactory->create(g_options.m_unixListen);
 
   g_unixChannel->listen(
diff --git a/tests/face/tcp.cpp b/tests/face/tcp.cpp
index 5990ab4..cba8796 100644
--- a/tests/face/tcp.cpp
+++ b/tests/face/tcp.cpp
@@ -17,8 +17,7 @@
 
 BOOST_AUTO_TEST_CASE(ChannelMap)
 {
-  boost::asio::io_service io;
-  TcpChannelFactory factory(io);
+  TcpChannelFactory factory;
   
   shared_ptr<TcpChannel> channel1 = factory.create("127.0.0.1", "20070");
   shared_ptr<TcpChannel> channel1a = factory.create("127.0.0.1", "20070");
@@ -147,7 +146,7 @@
   void
   abortTestCase(const std::string& message)
   {
-    m_ioService.stop();
+    g_io.stop();
     BOOST_FAIL(message);
   }
   
@@ -155,12 +154,11 @@
   void
   afterIo()
   {
-    if (--m_ioRemaining <= 0) m_ioService.stop();
+    if (--m_ioRemaining <= 0)
+      g_io.stop();
   }
 
 public:
-  boost::asio::io_service m_ioService;
-
   int m_ioRemaining;
 
   shared_ptr<Face> m_face1;
@@ -176,13 +174,12 @@
 
 BOOST_FIXTURE_TEST_CASE(EndToEnd, EndToEndFixture)
 {
-  TcpChannelFactory factory(m_ioService);
-  Scheduler scheduler(m_ioService); // to limit the amount of time the test may take
+  TcpChannelFactory factory;
 
   EventId abortEvent =
-    scheduler.scheduleEvent(time::seconds(10),
-                            bind(&EndToEndFixture::abortTestCase, this,
-                                 "TcpChannel error: cannot connect or cannot accept connection"));
+    scheduler::schedule(time::seconds(10),
+                        bind(&EndToEndFixture::abortTestCase, this,
+                             "TcpChannel error: cannot connect or cannot accept connection"));
   
   shared_ptr<TcpChannel> channel1 = factory.create("127.0.0.1", "20070");
   shared_ptr<TcpChannel> channel2 = factory.create("127.0.0.1", "20071");
@@ -196,9 +193,9 @@
                     time::seconds(4));
 
   m_ioRemaining = 2;
-  m_ioService.run();
-  m_ioService.reset();
-  scheduler.cancelEvent(abortEvent);
+  g_io.run();
+  g_io.reset();
+  scheduler::cancel(abortEvent);
 
   BOOST_REQUIRE(static_cast<bool>(m_face1));
   BOOST_REQUIRE(static_cast<bool>(m_face2));
@@ -212,9 +209,9 @@
   // integrated tests needs to check that TcpFace for non-loopback fails these tests...
   
   abortEvent =
-    scheduler.scheduleEvent(time::seconds(10),
-                            bind(&EndToEndFixture::abortTestCase, this,
-                                 "TcpChannel error: cannot send or receive Interest/Data packets"));
+    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");
@@ -236,8 +233,9 @@
   m_face2->sendData    (data2    );
 
   m_ioRemaining = 4;
-  m_ioService.run();
-  m_ioService.reset();
+  g_io.run();
+  g_io.reset();
+  scheduler::cancel(abortEvent);
 
   BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 1);
   BOOST_REQUIRE_EQUAL(m_face1_receivedDatas    .size(), 1);
@@ -252,13 +250,12 @@
 
 BOOST_FIXTURE_TEST_CASE(MultipleAccepts, EndToEndFixture)
 {
-  TcpChannelFactory factory(m_ioService);
-  Scheduler scheduler(m_ioService); // to limit the amount of time the test may take
+  TcpChannelFactory factory;
 
   EventId abortEvent =
-    scheduler.scheduleEvent(time::seconds(10),
-                            bind(&EndToEndFixture::abortTestCase, this,
-                                 "TcpChannel error: cannot connect or cannot accept connection"));
+    scheduler::schedule(time::seconds(10),
+                        bind(&EndToEndFixture::abortTestCase, this,
+                             "TcpChannel error: cannot connect or cannot accept connection"));
   
   shared_ptr<TcpChannel> channel1 = factory.create("127.0.0.1", "20070");
   shared_ptr<TcpChannel> channel2 = factory.create("127.0.0.1", "20071");
@@ -272,9 +269,9 @@
                     time::seconds(4)); // very short timeout
 
   m_ioRemaining = 2;
-  m_ioService.run();
-  m_ioService.reset();
-  scheduler.cancelEvent(abortEvent);
+  g_io.run();
+  g_io.reset();
+  scheduler::cancel(abortEvent);
 
   BOOST_CHECK_EQUAL(m_faces.size(), 2);
   
@@ -290,7 +287,7 @@
   BOOST_CHECK_NE(channel3, channel4);
   
   scheduler
-    .scheduleEvent
+    ::schedule
     (time::seconds(1),
      bind(&TcpChannel::connect, channel4,
           "127.0.0.1", "20070",
@@ -303,29 +300,29 @@
   
   m_ioRemaining = 4; // 2 connects and 2 accepts
   abortEvent = 
-    scheduler.scheduleEvent(time::seconds(10),
-                            bind(&EndToEndFixture::abortTestCase, this,
-                                 "TcpChannel error: cannot connect or cannot accept multiple connections"));
+    scheduler::schedule(time::seconds(10),
+                        bind(&EndToEndFixture::abortTestCase, this,
+                             "TcpChannel error: cannot connect or cannot accept multiple connections"));
 
-  scheduler.scheduleEvent(time::seconds(0.5),
-                          bind(&EndToEndFixture::checkFaceList, this, 4));
+  scheduler::schedule(time::seconds(0.5),
+                      bind(&EndToEndFixture::checkFaceList, this, 4));
   
-  m_ioService.run();
-  m_ioService.reset();
-  
+  g_io.run();
+  g_io.reset();
+  scheduler::cancel(abortEvent);
+
   BOOST_CHECK_EQUAL(m_faces.size(), 6);
 }
 
 
 BOOST_FIXTURE_TEST_CASE(FaceClosing, EndToEndFixture)
 {
-  TcpChannelFactory factory(m_ioService);
-  Scheduler scheduler(m_ioService); // to limit the amount of time the test may take
+  TcpChannelFactory factory;
 
   EventId abortEvent =
-    scheduler.scheduleEvent(time::seconds(10),
-                            bind(&EndToEndFixture::abortTestCase, this,
-                                 "TcpChannel error: cannot connect or cannot accept connection"));
+    scheduler::schedule(time::seconds(10),
+                        bind(&EndToEndFixture::abortTestCase, this,
+                             "TcpChannel error: cannot connect or cannot accept connection"));
   
   shared_ptr<TcpChannel> channel1 = factory.create("127.0.0.1", "20070");
   shared_ptr<TcpChannel> channel2 = factory.create("127.0.0.1", "20071");
@@ -339,17 +336,18 @@
                     time::seconds(4)); // very short timeout
 
   m_ioRemaining = 2;
-  BOOST_REQUIRE_NO_THROW(m_ioService.run());
-  m_ioService.reset();
-  scheduler.cancelEvent(abortEvent);
+  g_io.run();
+  // BOOST_REQUIRE_NO_THROW(g_io.run());
+  g_io.reset();
+  scheduler::cancel(abortEvent);
 
   BOOST_CHECK_EQUAL(channel1->size(), 1);
   BOOST_CHECK_EQUAL(channel2->size(), 1);
 
   abortEvent =
-    scheduler.scheduleEvent(time::seconds(10),
-                            bind(&EndToEndFixture::abortTestCase, this,
-                                 "FaceClosing error: cannot properly close faces"));
+    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));
@@ -358,9 +356,9 @@
   // just double check that we are calling the virtual method
   static_pointer_cast<Face>(m_face1)->close();
   
-  BOOST_REQUIRE_NO_THROW(m_ioService.run());
-  m_ioService.reset();
-  scheduler.cancelEvent(abortEvent);
+  BOOST_REQUIRE_NO_THROW(g_io.run());
+  g_io.reset();
+  scheduler::cancel(abortEvent);
 
   // both faces should get closed
   BOOST_CHECK(!static_cast<bool>(m_face1));
diff --git a/tests/face/unix-stream.cpp b/tests/face/unix-stream.cpp
index 8fba080..85bac65 100644
--- a/tests/face/unix-stream.cpp
+++ b/tests/face/unix-stream.cpp
@@ -19,8 +19,7 @@
 
 BOOST_AUTO_TEST_CASE(ChannelMap)
 {
-  boost::asio::io_service io;
-  UnixStreamChannelFactory factory(io);
+  UnixStreamChannelFactory factory;
 
   shared_ptr<UnixStreamChannel> channel1 = factory.create("foo");
   shared_ptr<UnixStreamChannel> channel1a = factory.create("foo");
@@ -113,7 +112,7 @@
   void
   abortTestCase(const std::string& message)
   {
-    m_ioService.stop();
+    g_io.stop();
     BOOST_FAIL(message);
   }
 
@@ -122,12 +121,10 @@
   afterIo()
   {
     if (--m_ioRemaining <= 0)
-      m_ioService.stop();
+      g_io.stop();
   }
 
 protected:
-  boost::asio::io_service m_ioService;
-
   int m_ioRemaining;
 
   shared_ptr<UnixStreamFace> m_face1;
@@ -143,34 +140,33 @@
 
 BOOST_FIXTURE_TEST_CASE(EndToEnd, EndToEndFixture)
 {
-  UnixStreamChannelFactory factory(m_ioService);
-  Scheduler scheduler(m_ioService); // to limit the amount of time the test may take
+  UnixStreamChannelFactory factory;
 
   EventId abortEvent =
-    scheduler.scheduleEvent(time::seconds(1),
-                            bind(&EndToEndFixture::abortTestCase, this,
-                                 "UnixStreamChannel error: cannot connect or cannot accept connection"));
+    scheduler::schedule(time::seconds(1),
+                        bind(&EndToEndFixture::abortTestCase, this,
+                             "UnixStreamChannel error: cannot connect or cannot accept connection"));
 
   shared_ptr<UnixStreamChannel> channel1 = factory.create("foo");
   channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated,   this, _1),
                    bind(&EndToEndFixture::channel1_onConnectFailed, this, _1));
 
   shared_ptr<stream_protocol::socket> client =
-      make_shared<stream_protocol::socket>(boost::ref(m_ioService));
+      make_shared<stream_protocol::socket>(boost::ref(g_io));
   client->async_connect(stream_protocol::endpoint("foo"),
                         bind(&EndToEndFixture::client_onConnect, this, _1));
 
   m_ioRemaining = 2;
-  m_ioService.run();
-  m_ioService.reset();
-  scheduler.cancelEvent(abortEvent);
+  g_io.run();
+  g_io.reset();
+  scheduler::cancel(abortEvent);
 
   BOOST_REQUIRE(static_cast<bool>(m_face1));
 
   abortEvent =
-    scheduler.scheduleEvent(time::seconds(1),
-                            bind(&EndToEndFixture::abortTestCase, this,
-                                 "UnixStreamChannel error: cannot send or receive Interest/Data packets"));
+    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 +=
@@ -198,8 +194,8 @@
   m_face2->sendData    (data2    );
 
   m_ioRemaining = 4;
-  m_ioService.run();
-  m_ioService.reset();
+  g_io.run();
+  g_io.reset();
 
   BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 1);
   BOOST_REQUIRE_EQUAL(m_face1_receivedDatas    .size(), 1);
@@ -214,44 +210,43 @@
 
 BOOST_FIXTURE_TEST_CASE(MultipleAccepts, EndToEndFixture)
 {
-  UnixStreamChannelFactory factory(m_ioService);
-  Scheduler scheduler(m_ioService); // to limit the amount of time the test may take
+  UnixStreamChannelFactory factory;
 
   EventId abortEvent =
-    scheduler.scheduleEvent(time::seconds(1),
-                            bind(&EndToEndFixture::abortTestCase, this,
-                                 "UnixStreamChannel error: cannot connect or cannot accept connection"));
+    scheduler::schedule(time::seconds(1),
+                        bind(&EndToEndFixture::abortTestCase, this,
+                             "UnixStreamChannel error: cannot connect or cannot accept connection"));
 
   shared_ptr<UnixStreamChannel> channel = factory.create("foo");
   channel->listen(bind(&EndToEndFixture::channel_onFaceCreated,   this, _1),
                   bind(&EndToEndFixture::channel_onConnectFailed, this, _1));
 
   shared_ptr<stream_protocol::socket> client1 =
-      make_shared<stream_protocol::socket>(boost::ref(m_ioService));
+      make_shared<stream_protocol::socket>(boost::ref(g_io));
   client1->async_connect(stream_protocol::endpoint("foo"),
                          bind(&EndToEndFixture::client_onConnect, this, _1));
 
   m_ioRemaining = 2;
-  m_ioService.run();
-  m_ioService.reset();
-  scheduler.cancelEvent(abortEvent);
+  g_io.run();
+  g_io.reset();
+  scheduler::cancel(abortEvent);
 
   BOOST_CHECK_EQUAL(m_faces.size(), 1);
 
   abortEvent =
-    scheduler.scheduleEvent(time::seconds(1),
-                            bind(&EndToEndFixture::abortTestCase, this,
-                                 "UnixStreamChannel error: cannot accept multiple connections"));
+    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(m_ioService));
+      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;
-  m_ioService.run();
-  m_ioService.reset();
-  scheduler.cancelEvent(abortEvent);
+  g_io.run();
+  g_io.reset();
+  scheduler::cancel(abortEvent);
 
   BOOST_CHECK_EQUAL(m_faces.size(), 2);
 
@@ -272,9 +267,9 @@
       bind(&EndToEndFixture::face2_onReceiveData, this, _1);
 
   abortEvent =
-    scheduler.scheduleEvent(time::seconds(1),
-                            bind(&EndToEndFixture::abortTestCase, this,
-                                 "UnixStreamChannel error: cannot send or receive Interest/Data packets"));
+    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");
@@ -296,8 +291,8 @@
   m_face2->sendData    (data2    );
 
   m_ioRemaining = 4;
-  m_ioService.run();
-  m_ioService.reset();
+  g_io.run();
+  g_io.reset();
 
   BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 1);
   BOOST_REQUIRE_EQUAL(m_face1_receivedDatas    .size(), 1);
@@ -317,34 +312,33 @@
 
 BOOST_FIXTURE_TEST_CASE(UnixStreamFaceLocalControlHeader, EndToEndFixture)
 {
-  UnixStreamChannelFactory factory(m_ioService);
-  Scheduler scheduler(m_ioService); // to limit the amount of time the test may take
+  UnixStreamChannelFactory factory;
 
   EventId abortEvent =
-    scheduler.scheduleEvent(time::seconds(1),
-                            bind(&EndToEndFixture::abortTestCase, this,
-                                 "UnixStreamChannel error: cannot connect or cannot accept connection"));
+    scheduler::schedule(time::seconds(1),
+                        bind(&EndToEndFixture::abortTestCase, this,
+                             "UnixStreamChannel error: cannot connect or cannot accept connection"));
 
   shared_ptr<UnixStreamChannel> channel1 = factory.create("foo");
   channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated,   this, _1),
                    bind(&EndToEndFixture::channel1_onConnectFailed, this, _1));
 
   shared_ptr<stream_protocol::socket> client =
-      make_shared<stream_protocol::socket>(boost::ref(m_ioService));
+      make_shared<stream_protocol::socket>(boost::ref(g_io));
   client->async_connect(stream_protocol::endpoint("foo"),
                         bind(&EndToEndFixture::client_onConnect, this, _1));
 
   m_ioRemaining = 2;
-  m_ioService.run();
-  m_ioService.reset();
-  scheduler.cancelEvent(abortEvent);
+  g_io.run();
+  g_io.reset();
+  scheduler::cancel(abortEvent);
 
   BOOST_REQUIRE(static_cast<bool>(m_face1));
 
   abortEvent =
-    scheduler.scheduleEvent(time::seconds(1),
-                            bind(&EndToEndFixture::abortTestCase, this,
-                                 "UnixStreamChannel error: cannot send or receive Interest/Data packets"));
+    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 +=
@@ -393,8 +387,8 @@
   //
 
   m_ioRemaining = 2;
-  m_ioService.run();
-  m_ioService.reset();
+  g_io.run();
+  g_io.reset();
 
   BOOST_REQUIRE_EQUAL(m_face2_receivedInterests.size(), 1);
   BOOST_REQUIRE_EQUAL(m_face2_receivedDatas    .size(), 1);
@@ -428,8 +422,8 @@
   client->async_send(dataWithHeader, bind(&noOp));
 
   m_ioRemaining = 2;
-  m_ioService.run();
-  m_ioService.reset();
+  g_io.run();
+  g_io.reset();
 
   BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 1);
   BOOST_REQUIRE_EQUAL(m_face1_receivedDatas    .size(), 1);
