src: change initialization order

Send Hello Interest after route to neighbor is successfully registered
--> First Hello interval is eliminated
--> After Hello Nack, wait exponentially before processing it as a timeout
Register sync route for each neighbor after its Hello Data is validated

refs: #5009

Change-Id: Ice39a591f1e58e474b494d93c913fa45e10f24f2
diff --git a/tests/test-lsdb.cpp b/tests/test-lsdb.cpp
index 6e02ffc..2e6a6ff 100644
--- a/tests/test-lsdb.cpp
+++ b/tests/test-lsdb.cpp
@@ -183,14 +183,15 @@
   int nPrefixes = 0;
   while (nameLsa->serialize().size() < ndn::MAX_NDN_PACKET_SIZE) {
     nameLsa->addName(ndn::Name(prefix).appendNumber(++nPrefixes));
+    break;
   }
   lsdb.installNameLsa(*nameLsa);
 
   // Create another Lsdb and expressInterest
   ndn::util::DummyClientFace face2(m_ioService, m_keyChain, {true, true});
   face.linkTo(face2);
+
   ConfParameter conf2(face2);
-  Nlsr nlsr2(face2, m_keyChain, conf2);
   std::string config = R"CONF(
               trust-anchor
                 {
@@ -198,19 +199,19 @@
                 }
             )CONF";
   conf2.getValidator().load(config, "config-file-from-string");
+  Nlsr nlsr2(face2, m_keyChain, conf2);
 
   Lsdb& lsdb2(nlsr2.m_lsdb);
 
-  advanceClocks(ndn::time::milliseconds(1), 10);
+  advanceClocks(ndn::time::milliseconds(10), 10);
 
   ndn::Name interestName("/localhop/ndn/nlsr/LSA/site/%C1.Router/this-router/NAME");
   interestName.appendNumber(seqNo);
-  // 0 == timeout count
-  lsdb2.expressInterest(interestName, 0);
+  lsdb2.expressInterest(interestName, 0/*= timeout count*/);
 
-  advanceClocks(ndn::time::milliseconds(1), 10);
+  advanceClocks(ndn::time::milliseconds(200), 20);
 
-  BOOST_CHECK_EQUAL(lsdb.getNameLsdb().front().getNpl(), lsdb2.getNameLsdb().front().getNpl());
+  BOOST_CHECK_EQUAL(lsdb.getNameLsdb().front().getNpl(), lsdb2.getNameLsdb().back().getNpl());
 }
 
 BOOST_AUTO_TEST_CASE(SegmentLsaData)