Remove dependency on Selectors and refactor codebase.

Change-Id: Ic3024b76ba0eea61f790c91c36090b4aa68702a3
Refs: #4522
diff --git a/tests/unit/tcp-bulk-insert-handle.cpp b/tests/unit/tcp-bulk-insert-handle.cpp
index f35a42f..48ec17d 100644
--- a/tests/unit/tcp-bulk-insert-handle.cpp
+++ b/tests/unit/tcp-bulk-insert-handle.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  Regents of the University of California.
+ * Copyright (c) 2014-2018,  Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -57,17 +57,16 @@
     ip::tcp::endpoint serverEndpoint = *endpoint;
 
     socket.async_connect(serverEndpoint,
-                         bind(&TcpClient::onSuccessfullConnect, this, _1));
+                         std::bind(&TcpClient::onSuccessfullConnect, this, _1));
   }
 
   virtual void
   onSuccessfullConnect(const boost::system::error_code& error)
   {
-    if (error)
-      {
-        BOOST_FAIL("TCP connection aborted");
-        return;
-      }
+    if (error) {
+      BOOST_FAIL("TCP connection aborted");
+      return;
+    }
   }
 
 public:
@@ -86,7 +85,7 @@
     , bulkInserter(ioService, *handle)
   {
     guardEvent = scheduler.scheduleEvent(ndn::time::seconds(2),
-                                         bind(&TcpBulkInsertFixture::fail, this, "Test timed out"));
+                                         std::bind(&TcpBulkInsertFixture::fail, this, "Test timed out"));
   }
 
   virtual void
@@ -102,15 +101,12 @@
     // described in http://www.boost.org/doc/libs/1_48_0/doc/html/boost_asio/overview/implementation.html,
     // scatter-gather is limited to at most `min(64,IOV_MAX)` buffers to be transmitted
     // in a single operation
-    for (typename Dataset::DataContainer::iterator i = this->data.begin();
-         i != this->data.end(); ++i) {
+    for (auto i = this->data.begin(); i != this->data.end(); ++i) {
 
-      socket.async_send(boost::asio::buffer((*i)->wireEncode().wire(),  (*i)->wireEncode().size()),
-                        bind(&TcpBulkInsertFixture::onSendFinished, this, _1, false));
+      socket.async_send(boost::asio::buffer((*i)->wireEncode().wire(), (*i)->wireEncode().size()),
+                        std::bind(&TcpBulkInsertFixture::onSendFinished, this, _1, false));
     }
-
-    socket.async_send(boost::asio::buffer(static_cast<const uint8_t*>(0), 0),
-                      bind(&TcpBulkInsertFixture::onSendFinished, this, _1, true));
+    onSendFinished(error, true);
   }
 
   void
@@ -127,7 +123,7 @@
       // In case there are some outstanding handlers
       // ioService.post(bind(&TcpBulkInsertFixture::stop, this));
       scheduler.scheduleEvent(ndn::time::seconds(1),
-                              bind(&TcpBulkInsertFixture::stop, this));
+                              std::bind(&TcpBulkInsertFixture::stop, this));
     }
   }
 
@@ -170,9 +166,8 @@
   this->ioService.run();
 
   // Read (all items should exist)
-  for (typename T::InterestContainer::iterator i = this->interests.begin();
-       i != this->interests.end(); ++i) {
-      BOOST_CHECK_EQUAL(*this->handle->readData(i->first), *i->second);
+  for (auto i = this->interests.begin(); i != this->interests.end(); ++i) {
+    BOOST_CHECK_EQUAL(*this->handle->readData(i->first), *i->second);
   }
 }