face: replace EventEmitter usage with Signal

refs #2300

Change-Id: I17d0d65d2c474b17dd9f23f271a6144b0b4fbc07
diff --git a/tests/daemon/mgmt/channel-status-publisher.cpp b/tests/daemon/mgmt/channel-status-publisher.cpp
index 370efe1..6ab42a3 100644
--- a/tests/daemon/mgmt/channel-status-publisher.cpp
+++ b/tests/daemon/mgmt/channel-status-publisher.cpp
@@ -144,8 +144,7 @@
       m_expectedEntries[expectedEntry.getLocalUri()] = expectedEntry;
     }
 
-  m_face->onReceiveData +=
-    bind(&ChannelStatusPublisherFixture::validatePublish, this, _1);
+  m_face->onReceiveData.connect(bind(&ChannelStatusPublisherFixture::validatePublish, this, _1));
 
   m_publisher.publish();
   BOOST_REQUIRE(m_finished);
@@ -171,8 +170,7 @@
       m_expectedEntries[expectedEntry.getLocalUri()] = expectedEntry;
     }
 
-  m_face->onReceiveData +=
-    bind(&ChannelStatusPublisherFixture::validatePublish, this, _1);
+  m_face->onReceiveData.connect(bind(&ChannelStatusPublisherFixture::validatePublish, this, _1));
 
   m_publisher.publish();
   BOOST_REQUIRE(m_finished);
diff --git a/tests/daemon/mgmt/face-manager.cpp b/tests/daemon/mgmt/face-manager.cpp
index 047f00c..447176c 100644
--- a/tests/daemon/mgmt/face-manager.cpp
+++ b/tests/daemon/mgmt/face-manager.cpp
@@ -797,9 +797,9 @@
 {
   shared_ptr<Interest> command(make_shared<Interest>("/localhost/nfd/faces"));
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 400, "Malformed command");
-  };
+  });
 
   getFace()->sendInterest(*command);
   g_io.run_one();
@@ -811,9 +811,9 @@
 {
   shared_ptr<Interest> command(make_shared<Interest>("/localhost/nfd/faces"));
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 400, "Malformed command");
-  };
+  });
 
   getManager().onFaceRequest(*command);
 
@@ -833,9 +833,9 @@
 
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 401, "Signature required");
-  };
+  });
 
   getManager().onFaceRequest(*command);
 
@@ -856,9 +856,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 403, "Unauthorized command");
-  };
+  });
 
   getManager().onFaceRequest(*command);
 
@@ -894,9 +894,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 501, "Unsupported command");
-  };
+  });
 
   getManager().onFaceRequest(*command);
 
@@ -910,7 +910,7 @@
 public:
 
   ValidatedFaceRequestFixture()
-    : FaceManager(TestFaceTableFixture::m_faceTable, TestFaceManagerCommon::m_face, m_testKeyChain),
+    : FaceManager(TestFaceTableFixture::m_faceTable, getFace(), m_testKeyChain),
       m_createFaceFired(false),
       m_destroyFaceFired(false)
   {
@@ -964,9 +964,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 400, "Malformed command");
-  };
+  });
 
   onValidatedFaceRequest(command);
 
@@ -1035,7 +1035,7 @@
 {
 public:
   LocalControlFixture()
-    : FaceManager(FaceTableFixture::m_faceTable, TestFaceManagerCommon::m_face, m_testKeyChain)
+    : FaceManager(FaceTableFixture::m_faceTable, getFace(), m_testKeyChain)
   {
   }
 };
@@ -1060,11 +1060,11 @@
 
   generateCommand(*enableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData +=
-  [this, enableCommand, encodedParameters] (const Data& response) {
-    this->validateControlResponse(response, enableCommand->getName(),
-                                  200, "Success", encodedParameters);
-  };
+  signal::Connection conn = getFace()->onReceiveData.connect(
+      [this, enableCommand, encodedParameters] (const Data& response) {
+        this->validateControlResponse(response, enableCommand->getName(),
+                                      200, "Success", encodedParameters);
+      });
 
   onValidatedFaceRequest(enableCommand);
 
@@ -1072,7 +1072,7 @@
   BOOST_REQUIRE(dummy->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID));
   BOOST_CHECK(!dummy->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID));
 
-  TestFaceManagerCommon::m_face->onReceiveData.clear();
+  conn.disconnect();
   resetCallbackFired();
 
   Name disable("/localhost/nfd/faces/disable-local-control");
@@ -1083,11 +1083,11 @@
 
   generateCommand(*disableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData +=
-  [this, disableCommand, encodedParameters] (const Data& response) {
-    this->validateControlResponse(response, disableCommand->getName(),
-                                  200, "Success", encodedParameters);
-  };
+  getFace()->onReceiveData.connect(
+      [this, disableCommand, encodedParameters] (const Data& response) {
+        this->validateControlResponse(response, disableCommand->getName(),
+                                      200, "Success", encodedParameters);
+      });
 
   onValidatedFaceRequest(disableCommand);
 
@@ -1116,9 +1116,10 @@
 
   generateCommand(*enableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData += [this, enableCommand] (const Data& response) {
-    this->validateControlResponse(response, enableCommand->getName(), 410, "Face not found");
-  };
+  signal::Connection conn = getFace()->onReceiveData.connect(
+      [this, enableCommand] (const Data& response) {
+        this->validateControlResponse(response, enableCommand->getName(), 410, "Face not found");
+      });
 
   onValidatedFaceRequest(enableCommand);
 
@@ -1126,7 +1127,7 @@
   BOOST_REQUIRE(!dummy->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID));
   BOOST_CHECK(!dummy->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID));
 
-  TestFaceManagerCommon::m_face->onReceiveData.clear();
+  conn.disconnect();
   resetCallbackFired();
 
   Name disable("/localhost/nfd/faces/disable-local-control");
@@ -1137,9 +1138,10 @@
 
   generateCommand(*disableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData += [this, disableCommand] (const Data& response) {
-    this->validateControlResponse(response, disableCommand->getName(), 410, "Face not found");
-  };
+  getFace()->onReceiveData.connect(
+      [this, disableCommand] (const Data& response) {
+        this->validateControlResponse(response, disableCommand->getName(), 410, "Face not found");
+      });
 
   onValidatedFaceRequest(disableCommand);
 
@@ -1167,9 +1169,11 @@
 
   generateCommand(*enableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData += [this, enableCommand] (const Data& response) {
-    this->validateControlResponse(response, enableCommand->getName(), 400, "Malformed command");
-  };
+  signal::Connection conn = getFace()->onReceiveData.connect(
+      [this, enableCommand] (const Data& response) {
+        this->validateControlResponse(response, enableCommand->getName(),
+                                      400, "Malformed command");
+      });
 
   onValidatedFaceRequest(enableCommand);
 
@@ -1177,7 +1181,7 @@
   BOOST_REQUIRE(!dummy->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID));
   BOOST_REQUIRE(!dummy->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID));
 
-  TestFaceManagerCommon::m_face->onReceiveData.clear();
+  conn.disconnect();
   resetCallbackFired();
 
   Name disable("/localhost/nfd/faces/disable-local-control");
@@ -1188,9 +1192,11 @@
 
   generateCommand(*disableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData += [this, disableCommand] (const Data& response) {
-    this->validateControlResponse(response, disableCommand->getName(), 400, "Malformed command");
-  };
+  getFace()->onReceiveData.connect(
+      [this, disableCommand] (const Data& response) {
+        this->validateControlResponse(response, disableCommand->getName(),
+                                      400, "Malformed command");
+      });
 
   onValidatedFaceRequest(disableCommand);
 
@@ -1219,15 +1225,17 @@
 
   generateCommand(*enableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData += [this, enableCommand] (const Data& response) {
-    this->validateControlResponse(response, enableCommand->getName(), 412, "Face is non-local");
-  };
+  signal::Connection conn = getFace()->onReceiveData.connect(
+      [this, enableCommand] (const Data& response) {
+        this->validateControlResponse(response, enableCommand->getName(),
+                                      412, "Face is non-local");
+      });
 
   onValidatedFaceRequest(enableCommand);
 
   BOOST_REQUIRE(didCallbackFire());
 
-  TestFaceManagerCommon::m_face->onReceiveData.clear();
+  conn.disconnect();
   resetCallbackFired();
 
   Name disable("/localhost/nfd/faces/disable-local-control");
@@ -1238,9 +1246,11 @@
 
   generateCommand(*disableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData += [this, disableCommand] (const Data& response) {
-    this->validateControlResponse(response, disableCommand->getName(), 412, "Face is non-local");
-  };
+  getFace()->onReceiveData.connect(
+      [this, disableCommand] (const Data& response) {
+        this->validateControlResponse(response, disableCommand->getName(),
+                                      412, "Face is non-local");
+      });
 
   onValidatedFaceRequest(disableCommand);
 
@@ -1267,11 +1277,11 @@
 
   generateCommand(*enableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData +=
-  [this, enableCommand, encodedParameters] (const Data& response) {
-    this->validateControlResponse(response, enableCommand->getName(),
-                                  200, "Success", encodedParameters);
-  };
+  signal::Connection conn = getFace()->onReceiveData.connect(
+      [this, enableCommand, encodedParameters] (const Data& response) {
+        this->validateControlResponse(response, enableCommand->getName(),
+                                      200, "Success", encodedParameters);
+      });
 
   onValidatedFaceRequest(enableCommand);
 
@@ -1280,7 +1290,7 @@
   BOOST_CHECK(!dummy->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID));
 
 
-  TestFaceManagerCommon::m_face->onReceiveData.clear();
+  conn.disconnect();
   resetCallbackFired();
 
   Name disable("/localhost/nfd/faces/disable-local-control");
@@ -1291,11 +1301,11 @@
 
   generateCommand(*disableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData +=
-  [this, disableCommand, encodedParameters] (const Data& response) {
-    this->validateControlResponse(response, disableCommand->getName(),
-                                  200, "Success", encodedParameters);
-  };
+  getFace()->onReceiveData.connect(
+      [this, disableCommand, encodedParameters] (const Data& response) {
+        this->validateControlResponse(response, disableCommand->getName(),
+                                      200, "Success", encodedParameters);
+      });
 
   onValidatedFaceRequest(disableCommand);
 
@@ -1324,9 +1334,10 @@
 
   generateCommand(*enableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData += [this, enableCommand] (const Data& response) {
-    this->validateControlResponse(response, enableCommand->getName(), 410, "Face not found");
-  };
+  signal::Connection conn = getFace()->onReceiveData.connect(
+      [this, enableCommand] (const Data& response) {
+        this->validateControlResponse(response, enableCommand->getName(), 410, "Face not found");
+      });
 
   onValidatedFaceRequest(enableCommand);
 
@@ -1335,7 +1346,7 @@
   BOOST_CHECK(!dummy->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID));
 
 
-  TestFaceManagerCommon::m_face->onReceiveData.clear();
+  conn.disconnect();
   resetCallbackFired();
 
   Name disable("/localhost/nfd/faces/disable-local-control");
@@ -1346,9 +1357,11 @@
 
   generateCommand(*disableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData += [this, disableCommand] (const Data& response) {
-    this->validateControlResponse(response, disableCommand->getName(), 410, "Face not found");
-  };
+  getFace()->onReceiveData.connect(
+      [this, disableCommand] (const Data& response) {
+        this->validateControlResponse(response, disableCommand->getName(),
+                                      410, "Face not found");
+      });
 
   onValidatedFaceRequest(disableCommand);
 
@@ -1377,15 +1390,17 @@
 
   generateCommand(*enableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData += [this, enableCommand] (const Data& response) {
-    this->validateControlResponse(response, enableCommand->getName(), 412, "Face is non-local");
-  };
+  signal::Connection conn = getFace()->onReceiveData.connect(
+      [this, enableCommand] (const Data& response) {
+        this->validateControlResponse(response, enableCommand->getName(),
+                                      412, "Face is non-local");
+      });
 
   onValidatedFaceRequest(enableCommand);
 
   BOOST_REQUIRE(didCallbackFire());
 
-  TestFaceManagerCommon::m_face->onReceiveData.clear();
+  conn.disconnect();
   resetCallbackFired();
 
   Name disable("/localhost/nfd/faces/disable-local-control");
@@ -1396,9 +1411,11 @@
 
   generateCommand(*disableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData += [this, disableCommand] (const Data& response) {
-    this->validateControlResponse(response, disableCommand->getName(), 412, "Face is non-local");
-  };
+  getFace()->onReceiveData.connect(
+      [this, disableCommand] (const Data& response) {
+        this->validateControlResponse(response, disableCommand->getName(),
+                                      412, "Face is non-local");
+      });
 
   onValidatedFaceRequest(disableCommand);
 
@@ -1412,7 +1429,7 @@
 public:
   FaceFixture()
     : FaceManager(FaceTableFixture::m_faceTable,
-                  TestFaceManagerCommon::m_face,
+                  getFace(),
                   m_testKeyChain)
     , m_receivedNotification(false)
   {
@@ -1514,9 +1531,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 400, "Malformed command");
-  };
+  });
 
   createFace(*command, parameters);
 
@@ -1536,9 +1553,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 400, "Non-canonical URI");
-  };
+  });
 
   createFace(*command, parameters);
 
@@ -1558,9 +1575,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 400, "Malformed command");
-  };
+  });
 
   createFace(*command, parameters);
 
@@ -1583,9 +1600,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 501, "Unsupported protocol");
-  };
+  });
 
   createFace(*command, parameters);
 
@@ -1622,11 +1639,11 @@
 
   Block encodedResultParameters(resultParameters.wireEncode());
 
-  getFace()->onReceiveData +=
-  [this, command, encodedResultParameters, expectedFaceEvent] (const Data& response) {
-    this->callbackDispatch(response,command->getName(), 200, "Success",
-                           encodedResultParameters, expectedFaceEvent);
-  };
+  getFace()->onReceiveData.connect(
+      [this, command, encodedResultParameters, expectedFaceEvent] (const Data& response) {
+        this->callbackDispatch(response,command->getName(), 200, "Success",
+                               encodedResultParameters, expectedFaceEvent);
+      });
 
   onCreated(command->getName(), parameters, dummy);
 
@@ -1648,9 +1665,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 408, "unit-test-reason");
-  };
+  });
 
   onConnectFailed(command->getName(), "unit-test-reason");
 
@@ -1684,11 +1701,11 @@
                    .setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL)
                    .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
 
-  getFace()->onReceiveData +=
-  [this, command, encodedParameters, expectedFaceEvent] (const Data& response) {
-    this->callbackDispatch(response,command->getName(), 200, "Success",
-                           encodedParameters, expectedFaceEvent);
-  };
+  getFace()->onReceiveData.connect(
+      [this, command, encodedParameters, expectedFaceEvent] (const Data& response) {
+        this->callbackDispatch(response,command->getName(), 200, "Success",
+                               encodedParameters, expectedFaceEvent);
+      });
 
   destroyFace(*command, parameters);
 
@@ -1737,8 +1754,8 @@
 
   ndn::EncodingBuffer buffer;
 
-  m_face->onReceiveData +=
-    bind(&FaceStatusPublisherFixture::decodeFaceStatusBlock, this, _1);
+  m_face->onReceiveData.connect(bind(&FaceStatusPublisherFixture::decodeFaceStatusBlock,
+                                     this, _1));
 
   m_manager.listFaces(*command);
   BOOST_REQUIRE(m_finished);
@@ -1777,8 +1794,8 @@
   ndn::nfd::ChannelStatus expectedEntry;
   expectedEntry.setLocalUri(DummyChannel("dummy://").getUri().toString());
 
-  m_face->onReceiveData +=
-    bind(&ChannelStatusFixture::validatePublish, this, _1, expectedEntry);
+  m_face->onReceiveData.connect(bind(&ChannelStatusFixture::validatePublish,
+                                     this, _1, expectedEntry));
 
   m_manager.listChannels(*request);
   BOOST_REQUIRE(m_callbackFired);
@@ -1828,8 +1845,8 @@
   shared_ptr<DummyLocalFace> face2(make_shared<DummyLocalFace>("tcp://", "tcp://"));
   add(face2);
 
-  m_face->onReceiveData +=
-    bind(&FaceQueryStatusPublisherFixture::decodeFaceStatusBlock, this, _1);
+  m_face->onReceiveData.connect(bind(&FaceQueryStatusPublisherFixture::decodeFaceStatusBlock,
+                                     this, _1));
 
   m_manager.listQueriedFaces(*query);
   BOOST_REQUIRE(m_finished);
@@ -1846,8 +1863,7 @@
   shared_ptr<DummyLocalFace> face(make_shared<DummyLocalFace>());
   add(face);
 
-  m_face->onReceiveData +=
-    bind(&FaceQueryStatusPublisherFixture::decodeNackBlock, this, _1);
+  m_face->onReceiveData.connect(bind(&FaceQueryStatusPublisherFixture::decodeNackBlock, this, _1));
 
   m_manager.listQueriedFaces(*query);
   BOOST_REQUIRE(m_finished);
diff --git a/tests/daemon/mgmt/face-status-publisher.cpp b/tests/daemon/mgmt/face-status-publisher.cpp
index 145fe0e..87ebba2 100644
--- a/tests/daemon/mgmt/face-status-publisher.cpp
+++ b/tests/daemon/mgmt/face-status-publisher.cpp
@@ -53,8 +53,8 @@
 
   ndn::EncodingBuffer buffer;
 
-  m_face->onReceiveData +=
-    bind(&FaceStatusPublisherFixture::decodeFaceStatusBlock, this, _1);
+  m_face->onReceiveData.connect(
+      bind(&FaceStatusPublisherFixture::decodeFaceStatusBlock, this, _1));
 
   m_publisher.publish();
   BOOST_REQUIRE(m_finished);
diff --git a/tests/daemon/mgmt/fib-enumeration-publisher.cpp b/tests/daemon/mgmt/fib-enumeration-publisher.cpp
index ed330aa..dc212d2 100644
--- a/tests/daemon/mgmt/fib-enumeration-publisher.cpp
+++ b/tests/daemon/mgmt/fib-enumeration-publisher.cpp
@@ -77,8 +77,8 @@
 
   ndn::EncodingBuffer buffer;
 
-  m_face->onReceiveData +=
-    bind(&FibEnumerationPublisherFixture::decodeFibEntryBlock, this, _1);
+  m_face->onReceiveData.connect(
+      bind(&FibEnumerationPublisherFixture::decodeFibEntryBlock, this, _1));
 
   m_publisher.publish();
   BOOST_REQUIRE(m_finished);
diff --git a/tests/daemon/mgmt/fib-manager.cpp b/tests/daemon/mgmt/fib-manager.cpp
index 525dfc8..c5a437a 100644
--- a/tests/daemon/mgmt/fib-manager.cpp
+++ b/tests/daemon/mgmt/fib-manager.cpp
@@ -241,9 +241,9 @@
 
   shared_ptr<Interest> command = makeInterest("/localhost/nfd/fib");
 
-  face->onReceiveData += [this, command] (const Data& response) {
+  face->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 400, "Malformed command");
-  };
+  });
 
   face->sendInterest(*command);
   g_io.run_one();
@@ -259,9 +259,9 @@
 
   Interest command("/localhost/nfd/fib");
 
-  face->onReceiveData += [this, command] (const Data& response) {
+  face->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command.getName(), 400, "Malformed command");
-  };
+  });
 
   getFibManager().onFibRequest(command);
 
@@ -286,9 +286,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  face->onReceiveData += [this, command] (const Data& response) {
+  face->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 501, "Unsupported command");
-  };
+  });
 
   getFibManager().onFibRequest(*command);
 
@@ -314,9 +314,9 @@
 
   Interest command(commandName);
 
-  face->onReceiveData += [this, command] (const Data& response) {
+  face->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command.getName(), 401, "Signature required");
-  };
+  });
 
   getFibManager().onFibRequest(command);
 
@@ -344,9 +344,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  face->onReceiveData += [this, command] (const Data& response) {
+  face->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 403, "Unauthorized command");
-  };
+  });
 
   getFibManager().onFibRequest(*command);
 
@@ -367,9 +367,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  face->onReceiveData += [this, command] (const Data& response) {
+  face->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 400, "Malformed command");
-  };
+  });
 
   getFibManager().onFibRequest(*command);
 
@@ -396,9 +396,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  face->onReceiveData += [this, command] (const Data& response) {
+  face->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 410, "Face not found");
-  };
+  });
 
   getFibManager().onFibRequest(*command);
 
@@ -436,17 +436,18 @@
     command->setIncomingFaceId(1);
     generateCommand(*command);
 
-    face->onReceiveData += [this, command, encodedExpectedParameters] (const Data& response) {
-      this->validateControlResponse(response, command->getName(),
-                                    200, "Success", encodedExpectedParameters);
-    };
+    signal::Connection conn = face->onReceiveData.connect(
+        [this, command, encodedExpectedParameters] (const Data& response) {
+          this->validateControlResponse(response, command->getName(),
+                                        200, "Success", encodedExpectedParameters);
+        });
 
     getFibManager().onFibRequest(*command);
 
     BOOST_REQUIRE(didCallbackFire());
     BOOST_REQUIRE(addedNextHopWithFace(getFib(), "/hello", 0, 101, getFace(1)));
 
-    face->onReceiveData.clear();
+    conn.disconnect();
     getFib().erase("/hello");
     BOOST_REQUIRE_EQUAL(getFib().size(), 0);
   }
@@ -472,10 +473,10 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  face->onReceiveData += [this, command, encodedParameters] (const Data& response) {
+  face->onReceiveData.connect([this, command, encodedParameters] (const Data& response) {
     this->validateControlResponse(response, command->getName(),
                                   200, "Success", encodedParameters);
-  };
+  });
 
   getFibManager().onFibRequest(*command);
 
@@ -507,10 +508,10 @@
   resultParameters.setFaceId(1);
   resultParameters.setCost(0);
 
-  face->onReceiveData += [this, command, resultParameters] (const Data& response) {
+  face->onReceiveData.connect([this, command, resultParameters] (const Data& response) {
     this->validateControlResponse(response, command->getName(),
                                   200, "Success", resultParameters.wireEncode());
-  };
+  });
 
   getFibManager().onFibRequest(*command);
 
@@ -540,10 +541,11 @@
       shared_ptr<Interest> command(make_shared<Interest>(commandName));
       generateCommand(*command);
 
-      face->onReceiveData += [this, command, encodedParameters] (const Data& response) {
-        this->validateControlResponse(response, command->getName(),
-                                      200, "Success", encodedParameters);
-      };
+      signal::Connection conn = face->onReceiveData.connect(
+          [this, command, encodedParameters] (const Data& response) {
+            this->validateControlResponse(response, command->getName(),
+                                          200, "Success", encodedParameters);
+          });
 
       getFibManager().onFibRequest(*command);
       BOOST_REQUIRE(didCallbackFire());
@@ -564,7 +566,7 @@
           BOOST_FAIL("Failed to find expected fib entry");
         }
 
-      face->onReceiveData.clear();
+      conn.disconnect();
     }
 }
 
@@ -589,18 +591,19 @@
     shared_ptr<Interest> command(make_shared<Interest>(commandName));
     generateCommand(*command);
 
-    face->onReceiveData += [this, command, encodedParameters] (const Data& response) {
-      this->validateControlResponse(response, command->getName(),
-                                    200, "Success", encodedParameters);
-    };
+    signal::Connection conn = face->onReceiveData.connect(
+        [this, command, encodedParameters] (const Data& response) {
+          this->validateControlResponse(response, command->getName(),
+                                        200, "Success", encodedParameters);
+        });
 
     getFibManager().onFibRequest(*command);
 
     BOOST_REQUIRE(didCallbackFire());
-  }
 
-  resetCallbackFired();
-  face->onReceiveData.clear();
+    resetCallbackFired();
+    conn.disconnect();
+  }
 
   {
     parameters.setCost(102);
@@ -614,10 +617,10 @@
     shared_ptr<Interest> command(make_shared<Interest>(commandName));
     generateCommand(*command);
 
-    face->onReceiveData += [this, command, encodedParameters] (const Data& response) {
+    face->onReceiveData.connect([this, command, encodedParameters] (const Data& response) {
       this->validateControlResponse(response, command->getName(),
                                     200, "Success", encodedParameters);
-    };
+    });
 
     getFibManager().onFibRequest(*command);
 
@@ -661,9 +664,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  face->onReceiveData += [this, command] (const Data& response) {
+  face->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 400, "Malformed command");
-  };
+  });
 
   getFibManager().onFibRequest(*command);
 
@@ -705,17 +708,18 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   fixture->generateCommand(*command);
 
-  face->onReceiveData += [fixture, command, encodedParameters] (const Data& response) {
-    fixture->validateControlResponse(response, command->getName(),
-                                     200, "Success", encodedParameters);
-  };
+  signal::Connection conn = face->onReceiveData.connect(
+      [fixture, command, encodedParameters] (const Data& response) {
+        fixture->validateControlResponse(response, command->getName(),
+                                         200, "Success", encodedParameters);
+      });
 
   manager.onFibRequest(*command);
 
   BOOST_REQUIRE(fixture->didCallbackFire());
 
   fixture->resetCallbackFired();
-  face->onReceiveData.clear();
+  conn.disconnect();
 }
 
 BOOST_AUTO_TEST_CASE(RemoveNextHop)
@@ -767,10 +771,10 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  face->onReceiveData += [this, command, encodedParameters] (const Data& response) {
+  face->onReceiveData.connect([this, command, encodedParameters] (const Data& response) {
     this->validateControlResponse(response, command->getName(),
                                   200, "Success", encodedParameters);
-  };
+  });
 
   getFibManager().onFibRequest(*command);
 
@@ -796,10 +800,10 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  face->onReceiveData += [this, command, encodedParameters] (const Data& response) {
+  face->onReceiveData.connect([this, command, encodedParameters] (const Data& response) {
     this->validateControlResponse(response, command->getName(),
                                   200, "Success", encodedParameters);
-  };
+  });
 
   getFibManager().onFibRequest(*command);
 
@@ -824,9 +828,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  face->onReceiveData += [this, command] (const Data& response) {
+  face->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 400, "Malformed command");
-  };
+  });
 
   getFibManager().onFibRequest(*command);
 
@@ -859,16 +863,17 @@
     resultParameters.setFaceId(1);
     resultParameters.setName("/hello");
 
-    face->onReceiveData += [this, command, resultParameters] (const Data& response) {
-      this->validateControlResponse(response, command->getName(),
-                                    200, "Success", resultParameters.wireEncode());
-    };
+    signal::Connection conn = face->onReceiveData.connect(
+        [this, command, resultParameters] (const Data& response) {
+          this->validateControlResponse(response, command->getName(),
+                                        200, "Success", resultParameters.wireEncode());
+        });
 
     getFibManager().onFibRequest(*command);
 
     BOOST_REQUIRE(didCallbackFire());
 
-    face->onReceiveData.clear();
+    conn.disconnect();
   }
 }
 
@@ -905,8 +910,8 @@
 
   ndn::EncodingBuffer buffer;
 
-  m_face->onReceiveData +=
-    bind(&FibEnumerationPublisherFixture::decodeFibEntryBlock, this, _1);
+  m_face->onReceiveData.connect(bind(&FibEnumerationPublisherFixture::decodeFibEntryBlock,
+                                     this, _1));
 
   shared_ptr<Interest> command(make_shared<Interest>("/localhost/nfd/fib/list"));
 
diff --git a/tests/daemon/mgmt/internal-face.cpp b/tests/daemon/mgmt/internal-face.cpp
index 2215c0e..ca2a899 100644
--- a/tests/daemon/mgmt/internal-face.cpp
+++ b/tests/daemon/mgmt/internal-face.cpp
@@ -31,8 +31,6 @@
 namespace nfd {
 namespace tests {
 
-NFD_LOG_INIT("InternalFaceTest");
-
 class InternalFaceFixture : protected BaseFixture
 {
 public:
@@ -112,7 +110,7 @@
 
   bool didPutData = false;
   Name dataName("/hello");
-  face->onReceiveData += bind(&validatePutData, ref(didPutData), dataName, _1);
+  face->onReceiveData.connect(bind(&validatePutData, ref(didPutData), dataName, _1));
 
   Data testData(dataName);
   m_keyChain.sign(testData);
diff --git a/tests/daemon/mgmt/manager-base.cpp b/tests/daemon/mgmt/manager-base.cpp
index 0aa7077..cfecc7d 100644
--- a/tests/daemon/mgmt/manager-base.cpp
+++ b/tests/daemon/mgmt/manager-base.cpp
@@ -166,9 +166,9 @@
   ndn::nfd::ControlParameters parameters;
   parameters.setName("/test/body");
 
-  getInternalFace()->onReceiveData += [this, parameters] (const Data& response) {
+  getInternalFace()->onReceiveData.connect([this, parameters] (const Data& response) {
     this->validateControlResponse(response, "/response", 100, "test", parameters.wireEncode());
-  };
+  });
 
   testSendResponse("/response", 100, "test", parameters.wireEncode());
   BOOST_REQUIRE(didCallbackFire());
@@ -177,9 +177,9 @@
 
 BOOST_AUTO_TEST_CASE(SendResponse3Arg)
 {
-  getInternalFace()->onReceiveData += [this] (const Data& response) {
+  getInternalFace()->onReceiveData.connect([this] (const Data& response) {
     this->validateControlResponse(response, "/response", 100, "test");
-  };
+  });
 
   testSendResponse("/response", 100, "test");
   BOOST_REQUIRE(didCallbackFire());
@@ -187,9 +187,9 @@
 
 BOOST_AUTO_TEST_CASE(SendResponse2Arg)
 {
-  getInternalFace()->onReceiveData += [this] (const Data& response) {
+  getInternalFace()->onReceiveData.connect([this] (const Data& response) {
     this->validateControlResponse(response, "/response", 100, "test");
-  };
+  });
 
   ControlResponse response(100, "test");
 
diff --git a/tests/daemon/mgmt/status-server.cpp b/tests/daemon/mgmt/status-server.cpp
index bda69a4..553e3fd 100644
--- a/tests/daemon/mgmt/status-server.cpp
+++ b/tests/daemon/mgmt/status-server.cpp
@@ -50,7 +50,7 @@
   time::system_clock::TimePoint t1 = time::system_clock::now();
   Forwarder forwarder;
   shared_ptr<InternalFace> internalFace = make_shared<InternalFace>();
-  internalFace->onReceiveData += &interceptResponse;
+  internalFace->onReceiveData.connect(&interceptResponse);
   ndn::KeyChain keyChain;
   StatusServer statusServer(internalFace, ref(forwarder), keyChain);
   time::system_clock::TimePoint t2 = time::system_clock::now();
diff --git a/tests/daemon/mgmt/strategy-choice-manager.cpp b/tests/daemon/mgmt/strategy-choice-manager.cpp
index 570c1d8..2125001 100644
--- a/tests/daemon/mgmt/strategy-choice-manager.cpp
+++ b/tests/daemon/mgmt/strategy-choice-manager.cpp
@@ -225,9 +225,9 @@
 {
   shared_ptr<Interest> command(make_shared<Interest>("/localhost/nfd/strategy-choice"));
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 400, "Malformed command");
-  };
+  });
 
   getFace()->sendInterest(*command);
   g_io.run_one();
@@ -239,9 +239,9 @@
 {
   shared_ptr<Interest> command(make_shared<Interest>("/localhost/nfd/strategy-choice"));
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 400, "Malformed command");
-  };
+  });
 
   getManager().onStrategyChoiceRequest(*command);
 
@@ -262,9 +262,9 @@
 
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 401, "Signature required");
-  };
+  });
 
   getManager().onStrategyChoiceRequest(*command);
 
@@ -287,9 +287,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 403, "Unauthorized command");
-  };
+  });
 
   getManager().onStrategyChoiceRequest(*command);
 
@@ -311,9 +311,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 501, "Unsupported command");
-  };
+  });
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -329,9 +329,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 400, "Malformed command");
-  };
+  });
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -352,10 +352,10 @@
 
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
 
-  getFace()->onReceiveData += [this, command, encodedParameters] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command, encodedParameters] (const Data& response) {
     this->validateControlResponse(response, command->getName(),
                                   200, "Success", encodedParameters);
-  };
+  });
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -378,10 +378,10 @@
 
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
 
-  getFace()->onReceiveData += [this, command, encodedParameters] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command, encodedParameters] (const Data& response) {
     this->validateControlResponse(response, command->getName(),
                                   200, "Success", encodedParameters);
-  };
+  });
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -408,10 +408,10 @@
   responseParameters.setName("/test");
   responseParameters.setStrategy("/localhost/nfd/strategy/test-strategy-c/%FD%02");
 
-  getFace()->onReceiveData += [this, command, responseParameters] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command, responseParameters] (const Data& response) {
     this->validateControlResponse(response, command->getName(),
                                   200, "Success", responseParameters.wireEncode());
-  };
+  });
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -433,9 +433,9 @@
 
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 400, "Malformed command");
-  };
+  });
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -455,9 +455,9 @@
 
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 400, "Malformed command");
-  };
+  });
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -481,9 +481,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 504, "Unsupported strategy");
-  };
+  });
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -555,10 +555,10 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData += [this, command, encodedParameters] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command, encodedParameters] (const Data& response) {
     this->validateControlResponse(response, command->getName(),
                                   200, "Success", encodedParameters);
-  };
+  });
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -582,10 +582,10 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(),
                                   403, "Cannot unset root prefix strategy");
-  };
+  });
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -612,9 +612,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData += [this, command] (const Data& response) {
+  getFace()->onReceiveData.connect([this, command] (const Data& response) {
     this->validateControlResponse(response, command->getName(), 400, "Malformed command");
-  };
+  });
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -633,8 +633,8 @@
   expectedChoice.setStrategy("/localhost/nfd/strategy/test-strategy-a");
   expectedChoice.setName("/");
 
-  getFace()->onReceiveData +=
-    bind(&StrategyChoiceManagerFixture::validateList, this, _1, expectedChoice);
+  getFace()->onReceiveData.connect(bind(&StrategyChoiceManagerFixture::validateList,
+                                        this, _1, expectedChoice));
 
   m_manager.onStrategyChoiceRequest(*command);
   BOOST_REQUIRE(didCallbackFire());
diff --git a/tests/daemon/mgmt/strategy-choice-publisher.cpp b/tests/daemon/mgmt/strategy-choice-publisher.cpp
index e85bc4a..e747c38 100644
--- a/tests/daemon/mgmt/strategy-choice-publisher.cpp
+++ b/tests/daemon/mgmt/strategy-choice-publisher.cpp
@@ -153,8 +153,7 @@
   m_expectedEntries["/test/a"] = expectedEntryA;
   m_expectedEntries["/test/b"] = expectedEntryB;
 
-  m_face->onReceiveData +=
-    bind(&StrategyChoicePublisherFixture::validatePublish, this, _1);
+  m_face->onReceiveData.connect(bind(&StrategyChoicePublisherFixture::validatePublish, this, _1));
 
   m_publisher.publish();
   BOOST_REQUIRE(m_finished);