build: Fix compilation errors and deprecation warnings

Change-Id: Ibbe2d30ced038f0c46a8669b5957b68c4f265350
diff --git a/src/sync-interest-table.cc b/src/sync-interest-table.cc
index 16706ea..f62d946 100644
--- a/src/sync-interest-table.cc
+++ b/src/sync-interest-table.cc
@@ -32,8 +32,8 @@
   : m_entryLifetime (lifetime)
   , m_scheduler(io)
 {
-  m_scheduler.schedulePeriodicEvent (ndn::time::seconds (4), ndn::time::seconds (4),
-                                     ndn::bind(&SyncInterestTable::expireInterests, this));
+  m_scheduler.scheduleEvent(ndn::time::seconds (4),
+                            ndn::bind(&SyncInterestTable::expireInterests, this));
 }
 
 SyncInterestTable::~SyncInterestTable ()
@@ -116,6 +116,9 @@
       else
         break;
   }
+
+  m_scheduler.scheduleEvent(ndn::time::seconds (4),
+                            ndn::bind(&SyncInterestTable::expireInterests, this));
 }
 
 
diff --git a/src/sync-intro-certificate.h b/src/sync-intro-certificate.h
index bc19fd2..737c921 100644
--- a/src/sync-intro-certificate.h
+++ b/src/sync-intro-certificate.h
@@ -106,7 +106,7 @@
   // Naming convention /<sync_prefix>/CHRONOS-INTRO-CERT/introducee_certname/introducer_certname/version
   ndn::Name dataName = data.getName();
 
-  if(dataName.size() < 4 || dataName.get(-4).toEscapedString() != "CHRONOS-INTRO-CERT")
+  if(dataName.size() < 4 || dataName.get(-4).toUri() != "CHRONOS-INTRO-CERT")
     throw Error("Not a Sync::IntroCertificate");
 
   try
diff --git a/src/sync-socket.cc b/src/sync-socket.cc
index b18f64c..adecec3 100644
--- a/src/sync-socket.cc
+++ b/src/sync-socket.cc
@@ -49,7 +49,7 @@
   , m_newDataCallback(dataCallback)
   , m_myCertificate(myCertificate)
   , m_face(face)
-  , m_ioService(face->ioService())
+  , m_ioService(face->getIoService())
 {
   if(withRoutingPrefix && !routingPrefix.isPrefixOf(m_dataPrefix))
     {
@@ -93,8 +93,8 @@
   data->setContent(reinterpret_cast<const uint8_t*>(buf), len);
   data->setFreshnessPeriod(time::milliseconds(1000*freshness));
 
-  m_ioService->post(bind(&SyncSocket::publishDataInternal, this,
-                         data, isCert));
+  m_ioService.post(bind(&SyncSocket::publishDataInternal, this,
+                        data, isCert));
 }
 
 void
@@ -164,7 +164,7 @@
   for(; it != end; it++)
     {
       offset--;
-      if(it->toEscapedString() == "%F0.")
+      if(it->toUri() == "%F0.")
         {
           encaped = true;
           break;
@@ -215,7 +215,7 @@
                             const OnDataValidated& onValidated)
 {
   if(data->getName().size() > interestNameSize
-     && data->getName().get(interestNameSize).toEscapedString() == "INTRO-CERT")
+     && data->getName().get(interestNameSize).toUri() == "INTRO-CERT")
     {
       if(!m_withSecurity)
         return;
diff --git a/src/sync-socket.h b/src/sync-socket.h
index abf1dfa..3dcef9e 100644
--- a/src/sync-socket.h
+++ b/src/sync-socket.h
@@ -189,7 +189,7 @@
   ndn::IdentityCertificate m_myCertificate;
   ndn::KeyChain m_keyChain;
   ndn::shared_ptr<ndn::Face> m_face;
-  ndn::shared_ptr<boost::asio::io_service> m_ioService;
+  boost::asio::io_service& m_ioService;
   bool m_withSecurity;
   ndn::shared_ptr<ndn::Validator> m_syncValidator;
   ndn::shared_ptr<SyncLogic>      m_syncLogic;
diff --git a/tests/test-socket.cc b/tests/test-socket.cc
index a9bdf29..2c0d216 100644
--- a/tests/test-socket.cc
+++ b/tests/test-socket.cc
@@ -139,9 +139,9 @@
 class TestSet1{
 public:
   TestSet1(ndn::shared_ptr<boost::asio::io_service> ioService)
-    : m_face1(new ndn::Face(ioService))
-    , m_face2(new ndn::Face(ioService))
-    , m_face3(new ndn::Face(ioService))
+    : m_face1(new ndn::Face(*ioService))
+    , m_face2(new ndn::Face(*ioService))
+    , m_face3(new ndn::Face(*ioService))
     , m_name1("/irl.cs.ucla.edu/" + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()))
     , m_name2("/yakshi.org/" + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()))
     , m_name3("/google.com/" + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()))
@@ -298,8 +298,8 @@
 class TestSet2{
 public:
   TestSet2(ndn::shared_ptr<boost::asio::io_service> ioService)
-    : m_face1(new ndn::Face(ioService))
-    , m_face2(new ndn::Face(ioService))
+    : m_face1(new ndn::Face(*ioService))
+    , m_face2(new ndn::Face(*ioService))
     , m_name1("/xiaonei.com/" + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()))
     , m_name2("/mitbbs.com/" + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()))
   {
@@ -416,8 +416,8 @@
 class TestSet3{
 public:
   TestSet3(ndn::shared_ptr<boost::asio::io_service> ioService)
-    : m_face1(new ndn::Face(ioService))
-    , m_face2(new ndn::Face(ioService))
+    : m_face1(new ndn::Face(*ioService))
+    , m_face2(new ndn::Face(*ioService))
     , m_name1("/xiaonei.com/" + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()))
     , m_name2("/mitbbs.com/" + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()))
   {
diff --git a/tests/test-sync-validator.cc b/tests/test-sync-validator.cc
index ec50717..a96c0bd 100644
--- a/tests/test-sync-validator.cc
+++ b/tests/test-sync-validator.cc
@@ -6,6 +6,10 @@
 #include <boost/test/unit_test.hpp>
 #include "sync-validator.h"
 
+#include <boost/lexical_cast.hpp>
+#include <boost/asio.hpp>
+#include <ndn-cxx/util/scheduler.hpp>
+
 BOOST_AUTO_TEST_SUITE(TestSyncValidator)
 
 void
@@ -68,7 +72,7 @@
   shared_ptr<IdentityCertificate> introducee2 = keychain.getCertificate(certName5);
 
   shared_ptr<boost::asio::io_service> ioService = make_shared<boost::asio::io_service>();
-  shared_ptr<Face> face = make_shared<Face>(ioService);
+  shared_ptr<Face> face = make_shared<Face>(ref(*ioService));
   shared_ptr<SecRuleRelative> rule;
   SyncValidator validator(prefix, *anchor, *face,
                           bind(&publishData, _1, _2, _3),
@@ -151,7 +155,7 @@
   shared_ptr<IdentityCertificate> introducee2 = keychain.getCertificate(certName5);
 
   shared_ptr<boost::asio::io_service> ioService = make_shared<boost::asio::io_service>();
-  shared_ptr<Face> face = make_shared<Face>(ioService);
+  shared_ptr<Face> face = make_shared<Face>(ref(*ioService));
   shared_ptr<SecRuleRelative> rule;
   SyncValidator validator(prefix, *anchor, *face,
                           bind(&publishData, _1, _2, _3),
@@ -246,7 +250,7 @@
   void
   terminate(ndn::shared_ptr<ndn::Face> face)
   {
-    face->ioService()->stop();
+    face->getIoService().stop();
   }
 
   const ndn::RegisteredPrefixId* regPrefixId;
@@ -282,8 +286,8 @@
   shared_ptr<IdentityCertificate> introducee2 = keychain.getCertificate(certName4);
 
   shared_ptr<boost::asio::io_service> ioService = make_shared<boost::asio::io_service>();
-  shared_ptr<Face> face = make_shared<Face>(ioService);
-  shared_ptr<Face> face2 = make_shared<Face>(ioService);
+  shared_ptr<Face> face = make_shared<Face>(ref(*ioService));
+  shared_ptr<Face> face2 = make_shared<Face>(ref(*ioService));
 
   shared_ptr<SecRuleRelative> rule;
   shared_ptr<SyncValidator> validator = shared_ptr<SyncValidator>