diff --git a/tests/communication/test-sync-protocol-adapter.cpp b/tests/communication/test-sync-protocol-adapter.cpp
new file mode 100644
index 0000000..707732b
--- /dev/null
+++ b/tests/communication/test-sync-protocol-adapter.cpp
@@ -0,0 +1,117 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2019,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#include "communication/sync-protocol-adapter.hpp"
+#include "../test-common.hpp"
+#include "../boost-test.hpp"
+
+#include <ndn-cxx/util/dummy-client-face.hpp>
+
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/vector.hpp>
+
+namespace nlsr {
+namespace test {
+
+using namespace ndn;
+
+class SyncProtocolAdapterFixture : public UnitTestTimeFixture
+{
+public:
+  SyncProtocolAdapterFixture()
+   : syncPrefix("/localhop/ndn/nlsr/sync/")
+   , nameLsaUserPrefix("/localhop/ndn/nlsr/LSA/NAME")
+   , syncInterestLifetime(time::seconds(60))
+  {
+  	syncPrefix.appendVersion(4);
+  }
+
+  template <int32_t T>
+  void
+  addNodes()
+  {
+    for (int i = 0; i < 2; i++) {
+      faces[i] = std::make_shared<ndn::util::DummyClientFace>(m_ioService,
+                                                              util::DummyClientFace::Options{true, true});
+      userPrefixes[i] = Name(nameLsaUserPrefix).appendNumber(i);
+      nodes[i] = std::make_shared<SyncProtocolAdapter>(*faces[i], T, syncPrefix,
+      	                                               userPrefixes[i],
+                                                       syncInterestLifetime,
+                                                       [i, this] (const ndn::Name& updateName,
+                                                                   uint64_t highSeq) {
+                                                         prefixToSeq[i].emplace(updateName, highSeq);
+                                                       });
+    }
+
+    faces[0]->linkTo(*faces[1]);
+    advanceClocks(ndn::time::milliseconds(10), 10);
+  }
+
+public:
+  Name syncPrefix, nameLsaUserPrefix;
+  Name userPrefixes[2];
+  time::milliseconds syncInterestLifetime;
+  std::shared_ptr<ndn::util::DummyClientFace> faces[2];
+  std::shared_ptr<SyncProtocolAdapter> nodes[2];
+  std::map<ndn::Name, uint64_t> prefixToSeq[2];
+};
+
+using boost::mpl::int_;
+using Protocols = boost::mpl::vector<int_<SYNC_PROTOCOL_CHRONOSYNC>, int_<SYNC_PROTOCOL_PSYNC>>;
+
+BOOST_FIXTURE_TEST_SUITE(TestSyncProtocolAdapter, SyncProtocolAdapterFixture)
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(Sync, SyncProtocol, Protocols)
+{
+  addNodes<SyncProtocol::value>();
+
+  nodes[0]->publishUpdate(userPrefixes[0], 10);
+  advanceClocks(ndn::time::milliseconds(1000), 100);
+
+  auto it = prefixToSeq[1].find(userPrefixes[0]);
+  BOOST_CHECK(it != prefixToSeq[1].end());
+  BOOST_CHECK_EQUAL(it->first, userPrefixes[0]);
+  BOOST_CHECK_EQUAL(it->second, 10);
+
+  nodes[1]->publishUpdate(userPrefixes[1], 100);
+  advanceClocks(ndn::time::milliseconds(1000), 100);
+
+  it = prefixToSeq[0].find(userPrefixes[1]);
+  BOOST_CHECK(it != prefixToSeq[0].end());
+  BOOST_CHECK_EQUAL(it->first, userPrefixes[1]);
+  BOOST_CHECK_EQUAL(it->second, 100);
+
+  Name adjLsaUserPrefix("/localhop/ndn/nlsr/LSA/ADJACENCY");
+  nodes[0]->addUserNode(adjLsaUserPrefix);
+  advanceClocks(ndn::time::milliseconds(1000), 100);
+  nodes[0]->publishUpdate(adjLsaUserPrefix, 10);
+  advanceClocks(ndn::time::milliseconds(1000), 100);
+
+  it = prefixToSeq[1].find(adjLsaUserPrefix);
+  BOOST_CHECK(it != prefixToSeq[1].end());
+  BOOST_CHECK_EQUAL(it->first, adjLsaUserPrefix);
+  BOOST_CHECK_EQUAL(it->second, 10);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace test
+} // namespace nlsr
\ No newline at end of file
