diff --git a/tests/test-socket.cc b/tests/test-socket.cc
index e4791c2..a10a2f1 100644
--- a/tests/test-socket.cc
+++ b/tests/test-socket.cc
@@ -142,93 +142,94 @@
     : m_face1(new ndn::Face(ioService))
     , m_face2(new ndn::Face(ioService))
     , m_face3(new ndn::Face(ioService))
-    , m_p1("/irl.cs.ucla.edu")
-    , m_p2("/yakshi.org")
-    , m_p3("/google.com")
-    , m_syncPrefix("/let/us/sync")
+    , m_name1("/irl.cs.ucla.edu/" + boost::lexical_cast<std::string>(ndn::time::now()))
+    , m_name2("/yakshi.org/" + boost::lexical_cast<std::string>(ndn::time::now()))
+    , m_name3("/google.com/" + boost::lexical_cast<std::string>(ndn::time::now()))
   {
-    ndn::KeyChain keyChain;
-    m_name1 = m_p1;
-    m_name1.append(boost::lexical_cast<std::string>(ndn::time::now()));
-    ndn::Name certName1 = keyChain.createIdentity(m_name1);
-    m_id1 = keyChain.getCertificate(certName1);
+    m_id1 = m_keyChain.getCertificate(m_keyChain.createIdentity(m_name1));
+    m_id2 = m_keyChain.getCertificate(m_keyChain.createIdentity(m_name2));
+    m_id3 = m_keyChain.getCertificate(m_keyChain.createIdentity(m_name3));
 
-    m_name2 = m_p2;
-    m_name2.append(boost::lexical_cast<std::string>(ndn::time::now()));
-    ndn::Name certName2 = keyChain.createIdentity(m_name2);
-    m_id2 = keyChain.getCertificate(certName2);
-
-    m_name3 = m_p3;
-    m_name3.append(boost::lexical_cast<std::string>(ndn::time::now()));
-    ndn::Name certName3 = keyChain.createIdentity(m_name3);
-    m_id3 = keyChain.getCertificate(certName3);
-
-    ndn::shared_ptr<ndn::SecRuleRelative> rule = ndn::make_shared<ndn::SecRuleRelative>("^(<>*)<><>$",
-                                                                                        "^(<>*)<><KEY><ksk-.*><ID-CERT>$",
-                                                                                        "==", "\\1", "\\1", true);
-
-    m_v1 = ndn::make_shared<SyncValidator>(m_syncPrefix, *m_id1, m_face1, rule);
-    m_v1->addParticipant(*m_id2);
-    m_v2 = ndn::make_shared<SyncValidator>(m_syncPrefix, *m_id2, m_face2, rule);
-    m_v2->addParticipant(*m_id1);
-    m_v2->addParticipant(*m_id3);
-    m_v3 = ndn::make_shared<SyncValidator>(m_syncPrefix, *m_id3, m_face3, rule);
-    m_v3->addParticipant(*m_id2);
+    m_rule = ndn::make_shared<ndn::SecRuleRelative>("^(<>*)<><>$",
+                                                    "^(<>*)<><KEY><ksk-.*><ID-CERT>$",
+                                                    "==", "\\1", "\\1", true);
   }
 
   void
   createSyncSocket1()
   {
     _LOG_DEBUG ("s1");
-    m_s1 = ndn::make_shared<SyncSocket>(m_syncPrefix, m_name1, m_v1, m_face1, 
-                                   bind(&TestSocketApp::fetchAll, &m_a1, _1, _2), 
-                                   bind(&TestSocketApp::pass, &m_a1, _1));
+
+    m_s1 = ndn::make_shared<SyncSocket>("/let/us/sync",
+                                        "/irl.cs.ucla.edu",
+                                        0,
+                                        *m_id1,
+                                        m_rule,
+                                        m_face1,
+                                        bind(&TestSocketApp::fetchAll, &m_a1, _1, _2), 
+                                        bind(&TestSocketApp::pass, &m_a1, _1));
+    m_s1->addParticipant(*m_id2);
   }
 
   void
   createSyncSocket2()
   {
     _LOG_DEBUG ("s2");
-    m_s2 = ndn::make_shared<SyncSocket>(m_syncPrefix, m_name2, m_v2, m_face2, 
-                                   bind(&TestSocketApp::fetchAll, &m_a2, _1, _2), 
-                                   bind(&TestSocketApp::pass, &m_a2, _1));
+
+    m_s2 = ndn::make_shared<SyncSocket>("/let/us/sync",
+                                        "/yakshi.org",
+                                        0,
+                                        *m_id2,
+                                        m_rule,
+                                        m_face2,
+                                        bind(&TestSocketApp::fetchAll, &m_a2, _1, _2), 
+                                        bind(&TestSocketApp::pass, &m_a2, _1));
+    m_s2->addParticipant(*m_id1);
+    m_s2->addParticipant(*m_id3);
   }
   
   void
   createSyncSocket3()
   {
     _LOG_DEBUG ("s3");
-    m_s3 = ndn::make_shared<SyncSocket>(m_syncPrefix, m_name3, m_v3, m_face3, 
-                                   bind(&TestSocketApp::fetchAll, &m_a3, _1, _2), 
-                                   bind(&TestSocketApp::pass, &m_a3, _1));
+
+    m_s3 = ndn::make_shared<SyncSocket>("/let/us/sync",
+                                        "/google.com",
+                                        0,
+                                        *m_id3,
+                                        m_rule, 
+                                        m_face3, 
+                                        bind(&TestSocketApp::fetchAll, &m_a3, _1, _2), 
+                                        bind(&TestSocketApp::pass, &m_a3, _1));
+    m_s3->addParticipant(*m_id2);
   }
 
   void
-  publishSocket1(uint32_t session, string data)
+  publishSocket1(string data)
   {
     _LOG_DEBUG ("s1 publish");
-    m_s1->publishData (m_p1, session, data.c_str(), data.size(), 1000); 
+    m_s1->publishData (reinterpret_cast<const uint8_t*>(data.c_str()), data.size(), 1000); 
   }
 
   void
-  publishSocket2(uint32_t session, string data)
+  publishSocket2(string data)
   {
     _LOG_DEBUG ("s2 publish");
-    m_s2->publishData (m_p2, session, data.c_str(), data.size(), 1000); 
+    m_s2->publishData (reinterpret_cast<const uint8_t*>(data.c_str()), data.size(), 1000); 
   }
 
   void
-  publishSocket3(uint32_t session, string data)
+  publishSocket3(string data)
   {
     _LOG_DEBUG ("s3 publish");
-    m_s3->publishData (m_p3, session, data.c_str(), data.size(), 1000); 
+    m_s3->publishData (reinterpret_cast<const uint8_t*>(data.c_str()), data.size(), 1000); 
   }
 
   void
   setSocket1(string suffix, string data)
   {
     _LOG_DEBUG ("a1 set");
-    ndn::Name name = m_p1;
+    ndn::Name name("/irl.cs.ucla.edu");
     name.append(suffix);
     m_a1.set (name, data.c_str(), data.size()); 
   }
@@ -237,7 +238,7 @@
   setSocket2(string suffix, string data)
   {
     _LOG_DEBUG ("a2 set");
-    ndn::Name name = m_p2;
+    ndn::Name name("/yakshi.org");
     name.append(suffix);
     m_a2.set (name, data.c_str(), data.size()); 
   }
@@ -246,7 +247,7 @@
   setSocket3(string suffix, string data)
   {
     _LOG_DEBUG ("a3 set");
-    ndn::Name name = m_p3;
+    ndn::Name name("/google.com");
     name.append(suffix);
     m_a3.set (name, data.c_str(), data.size()); 
   }
@@ -264,26 +265,21 @@
     m_s1.reset();
     m_s2.reset();
     m_s3.reset();
-    m_v1.reset();
-    m_v2.reset();
-    m_v3.reset();
 
-    ndn::KeyChain keyChain;
-    keyChain.deleteIdentity(m_name1);
-    keyChain.deleteIdentity(m_name2);
-    keyChain.deleteIdentity(m_name3);
+    m_keyChain.deleteIdentity(m_name1);
+    m_keyChain.deleteIdentity(m_name2);
+    m_keyChain.deleteIdentity(m_name3);
 
   }
 
+  ndn::KeyChain m_keyChain;
+  ndn::shared_ptr<ndn::SecRuleRelative> m_rule;
 
-  TestSocketApp m_a1, m_a2, m_a3;
-  ndn::shared_ptr<ndn::IdentityCertificate> m_id1, m_id2, m_id3;
-  ndn::shared_ptr<Sync::SyncValidator> m_v1, m_v2, m_v3;
   ndn::shared_ptr<ndn::Face> m_face1, m_face2, m_face3;
   ndn::Name m_name1, m_name2, m_name3;
-  ndn::Name m_p1, m_p2, m_p3;
+  TestSocketApp m_a1, m_a2, m_a3;
+  ndn::shared_ptr<ndn::IdentityCertificate> m_id1, m_id2, m_id3;
   ndn::shared_ptr<SyncSocket> m_s1, m_s2, m_s3;
-  ndn::Name m_syncPrefix;
 };
 
 class TestSet2{
@@ -291,76 +287,77 @@
   TestSet2(ndn::shared_ptr<boost::asio::io_service> ioService)
     : m_face1(new ndn::Face(ioService))
     , m_face2(new ndn::Face(ioService))
-    , m_p1("/xiaonei.com")
-    , m_p2("/mitbbs.com")
-    , m_syncPrefix("/this/is/the/prefix")
+    , m_name1("/xiaonei.com/" + boost::lexical_cast<std::string>(ndn::time::now()))
+    , m_name2("/mitbbs.com/" + boost::lexical_cast<std::string>(ndn::time::now()))
   {
-    ndn::KeyChain keyChain;
-    m_name1 = m_p1;
-    m_name1.append(boost::lexical_cast<string>(ndn::time::now()));
-    ndn::Name certName1 = keyChain.createIdentity(m_name1);
-    m_id1 = keyChain.getCertificate(certName1);
+    m_id1 = m_keyChain.getCertificate(m_keyChain.createIdentity(m_name1));
+    m_id2 = m_keyChain.getCertificate(m_keyChain.createIdentity(m_name2));
 
-    m_name2 = m_p2;
-    m_name2.append(boost::lexical_cast<string>(ndn::time::now()));
-    ndn::Name certName2 = keyChain.createIdentity(m_name2);
-    m_id2 = keyChain.getCertificate(certName2);
-
-    ndn::shared_ptr<ndn::SecRuleRelative> rule = ndn::make_shared<ndn::SecRuleRelative>("^(<>*)<><>$",
-                                                                                        "^(<>*)<><KEY><ksk-.*><ID-CERT>$",
-                                                                                        "==", "\\1", "\\1", true);
-
-    m_v1 = ndn::make_shared<SyncValidator>(m_syncPrefix, *m_id1, m_face1, rule);
-    m_v1->addParticipant(*m_id2);
-    m_v2 = ndn::make_shared<SyncValidator>(m_syncPrefix, *m_id2, m_face2, rule);
-    m_v2->addParticipant(*m_id1);
-
+    m_rule = ndn::make_shared<ndn::SecRuleRelative>("^(<>*)<><>$",
+                                                    "^(<>*)<><KEY><ksk-.*><ID-CERT>$",
+                                                    "==", "\\1", "\\1", true);
   }
 
   void
   createSyncSocket1()
   {
     _LOG_DEBUG ("s1");
-    m_s1 = ndn::make_shared<SyncSocket>(m_syncPrefix, m_name1, m_v1, m_face1, 
-                                   bind(&TestSocketApp::fetchNumbers, &m_a1, _1, _2), 
-                                   bind(&TestSocketApp::pass, &m_a1, _1));
+    
+    m_s1 = ndn::make_shared<SyncSocket>("/this/is/the/prefix",
+                                        "/xiaonei.com",
+                                        0,
+                                        *m_id1,
+                                        m_rule,
+                                        m_face1,
+                                        bind(&TestSocketApp::fetchNumbers, &m_a1, _1, _2), 
+                                        bind(&TestSocketApp::pass, &m_a1, _1));
+
+    m_s1->addParticipant(*m_id2);
   }
 
   void
   createSyncSocket2()
   {
     _LOG_DEBUG ("s2");
-    m_s2 = ndn::make_shared<SyncSocket>(m_syncPrefix, m_name2, m_v2, m_face2, 
-                                   bind(&TestSocketApp::fetchNumbers, &m_a2, _1, _2), 
-                                   bind(&TestSocketApp::pass, &m_a2, _1));
+
+    m_s2 = ndn::make_shared<SyncSocket>("/this/is/the/prefix",
+                                        "/mitbbs.com",
+                                        0,
+                                        *m_id2,
+                                        m_rule,
+                                        m_face2,
+                                        bind(&TestSocketApp::fetchNumbers, &m_a2, _1, _2), 
+                                        bind(&TestSocketApp::pass, &m_a2, _1));
+
+    m_s2->addParticipant(*m_id1);
   }
   
   void
-  publishSocket1(uint32_t session, string data)
+  publishSocket1(string data)
   {
     _LOG_DEBUG ("s1 publish");
-    m_s1->publishData (m_p1, session, data.c_str(), data.size(), 1000); 
+    m_s1->publishData (reinterpret_cast<const uint8_t*>(data.c_str()), data.size(), 1000); 
   }
 
   void
-  publishSocket2(uint32_t session, string data)
+  publishSocket2(string data)
   {
     _LOG_DEBUG ("s2 publish");
-    m_s2->publishData (m_p2, session, data.c_str(), data.size(), 1000); 
+    m_s2->publishData (reinterpret_cast<const uint8_t*>(data.c_str()), data.size(), 1000); 
   }
 
   void
   setSocket1(const char* ptr, size_t size)
   {
     _LOG_DEBUG ("a1 setNum");
-    m_a1.setNum (m_p1, ptr, size); 
+    m_a1.setNum ("/xiaonei.com", ptr, size); 
   }
 
   void
   setSocket2(const char* ptr, size_t size)
   {
     _LOG_DEBUG ("a2 setNum");
-    m_a2.setNum (m_p2, ptr, size); 
+    m_a2.setNum ("/mitbbs.com", ptr, size); 
   }
 
   void
@@ -378,22 +375,19 @@
   {
     m_s1.reset();
     m_s2.reset();
-    m_v1.reset();
-    m_v2.reset();
 
-    ndn::KeyChain keyChain;
-    keyChain.deleteIdentity(m_name1);
-    keyChain.deleteIdentity(m_name2);
+    m_keyChain.deleteIdentity(m_name1);
+    m_keyChain.deleteIdentity(m_name2);
   }
 
+  ndn::KeyChain m_keyChain;
+  ndn::shared_ptr<ndn::SecRuleRelative> m_rule;
+
   TestSocketApp m_a1, m_a2;
   ndn::shared_ptr<ndn::IdentityCertificate> m_id1, m_id2;
-  ndn::shared_ptr<Sync::SyncValidator> m_v1, m_v2;
   ndn::shared_ptr<ndn::Face> m_face1, m_face2;
-  ndn::Name m_p1, m_p2;
   ndn::Name m_name1, m_name2;
   ndn::shared_ptr<SyncSocket> m_s1, m_s2;
-  ndn::Name m_syncPrefix;
 };
 
 BOOST_AUTO_TEST_CASE (AppSocketTest1)
@@ -408,34 +402,34 @@
   scheduler.scheduleEvent(ndn::time::seconds(0.05), ndn::bind(&TestSet1::createSyncSocket2, &testSet1));
   scheduler.scheduleEvent(ndn::time::seconds(0.10), ndn::bind(&TestSet1::createSyncSocket3, &testSet1));
   string data0 = "Very funny Scotty, now beam down my clothes";
-  scheduler.scheduleEvent(ndn::time::seconds(0.15), ndn::bind(&TestSet1::publishSocket1, &testSet1, 0, data0));
-  scheduler.scheduleEvent(ndn::time::seconds(1.15), ndn::bind(&TestSet1::setSocket1, &testSet1, "/0/0", data0));
+  scheduler.scheduleEvent(ndn::time::seconds(0.15), ndn::bind(&TestSet1::publishSocket1, &testSet1, data0));
+  scheduler.scheduleEvent(ndn::time::seconds(1.15), ndn::bind(&TestSet1::setSocket1, &testSet1, "/0/1", data0));
   scheduler.scheduleEvent(ndn::time::seconds(1.16), ndn::bind(&TestSet1::check, &testSet1, 1)); 
   string data1 = "Yes, give me that ketchup";
   string data2 = "Don't look conspicuous, it draws fire";
-  scheduler.scheduleEvent(ndn::time::seconds(1.17), ndn::bind(&TestSet1::publishSocket1, &testSet1, 0, data1));
-  scheduler.scheduleEvent(ndn::time::seconds(1.18), ndn::bind(&TestSet1::publishSocket1, &testSet1, 0, data2));
-  scheduler.scheduleEvent(ndn::time::seconds(2.15), ndn::bind(&TestSet1::setSocket1, &testSet1, "/0/1", data1));
-  scheduler.scheduleEvent(ndn::time::seconds(2.16), ndn::bind(&TestSet1::setSocket1, &testSet1, "/0/2", data2));
+  scheduler.scheduleEvent(ndn::time::seconds(1.17), ndn::bind(&TestSet1::publishSocket1, &testSet1, data1));
+  scheduler.scheduleEvent(ndn::time::seconds(1.18), ndn::bind(&TestSet1::publishSocket1, &testSet1, data2));
+  scheduler.scheduleEvent(ndn::time::seconds(2.15), ndn::bind(&TestSet1::setSocket1, &testSet1, "/0/2", data1));
+  scheduler.scheduleEvent(ndn::time::seconds(2.16), ndn::bind(&TestSet1::setSocket1, &testSet1, "/0/3", data2));
   scheduler.scheduleEvent(ndn::time::seconds(2.17), ndn::bind(&TestSet1::check, &testSet1, 2));
   string data3 = "You surf the Internet, I surf the real world";
   string data4 = "I got a fortune cookie once that said 'You like Chinese food'";
   string data5 = "Real men wear pink. Why? Because their wives make them";
-  scheduler.scheduleEvent(ndn::time::seconds(3.18), ndn::bind(&TestSet1::publishSocket3, &testSet1, 0, data3));
-  scheduler.scheduleEvent(ndn::time::seconds(3.20), ndn::bind(&TestSet1::publishSocket2, &testSet1, 0, data4));
-  scheduler.scheduleEvent(ndn::time::seconds(3.21), ndn::bind(&TestSet1::publishSocket2, &testSet1, 0, data5));
-  scheduler.scheduleEvent(ndn::time::seconds(4.21), ndn::bind(&TestSet1::setSocket3, &testSet1, "/0/0", data3));
-  scheduler.scheduleEvent(ndn::time::seconds(4.22), ndn::bind(&TestSet1::setSocket2, &testSet1, "/0/0", data4));
-  scheduler.scheduleEvent(ndn::time::seconds(4.23), ndn::bind(&TestSet1::setSocket2, &testSet1, "/0/1", data5));
-  scheduler.scheduleEvent(ndn::time::seconds(4.30), ndn::bind(&TestSet1::check, &testSet1, 3));
+  scheduler.scheduleEvent(ndn::time::seconds(3.18), ndn::bind(&TestSet1::publishSocket3, &testSet1, data3));
+  scheduler.scheduleEvent(ndn::time::seconds(3.20), ndn::bind(&TestSet1::publishSocket2, &testSet1, data4));
+  scheduler.scheduleEvent(ndn::time::seconds(3.21), ndn::bind(&TestSet1::publishSocket2, &testSet1, data5));
+  scheduler.scheduleEvent(ndn::time::seconds(4.71), ndn::bind(&TestSet1::setSocket3, &testSet1, "/0/1", data3));
+  scheduler.scheduleEvent(ndn::time::seconds(4.72), ndn::bind(&TestSet1::setSocket2, &testSet1, "/0/2", data4));
+  scheduler.scheduleEvent(ndn::time::seconds(4.73), ndn::bind(&TestSet1::setSocket2, &testSet1, "/0/3", data5));
+  scheduler.scheduleEvent(ndn::time::seconds(4.80), ndn::bind(&TestSet1::check, &testSet1, 3));
   // not sure weither this is simultanous data generation from multiple sources
   _LOG_DEBUG ("Simultaneous publishing");
   string data6 = "Shakespeare says: 'Prose before hos.'";
   string data7 = "Pick good people, talent never wears out";
-  scheduler.scheduleEvent(ndn::time::seconds(5.50), ndn::bind(&TestSet1::publishSocket1, &testSet1, 0, data6));
-  scheduler.scheduleEvent(ndn::time::seconds(5.50), ndn::bind(&TestSet1::publishSocket2, &testSet1, 0, data7));
-  scheduler.scheduleEvent(ndn::time::seconds(6.80), ndn::bind(&TestSet1::setSocket1, &testSet1, "/0/3", data6));
-  scheduler.scheduleEvent(ndn::time::seconds(6.80), ndn::bind(&TestSet1::setSocket2, &testSet1, "/0/2", data7));
+  scheduler.scheduleEvent(ndn::time::seconds(5.50), ndn::bind(&TestSet1::publishSocket1, &testSet1, data6));
+  scheduler.scheduleEvent(ndn::time::seconds(5.50), ndn::bind(&TestSet1::publishSocket2, &testSet1, data7));
+  scheduler.scheduleEvent(ndn::time::seconds(6.80), ndn::bind(&TestSet1::setSocket1, &testSet1, "/0/4", data6));
+  scheduler.scheduleEvent(ndn::time::seconds(6.80), ndn::bind(&TestSet1::setSocket2, &testSet1, "/0/4", data7));
   scheduler.scheduleEvent(ndn::time::seconds(6.90), ndn::bind(&TestSet1::check, &testSet1, 4));
   scheduler.scheduleEvent(ndn::time::seconds(7.00), ndn::bind(&TestSet1::done, &testSet1));
 
@@ -452,12 +446,12 @@
   scheduler.scheduleEvent(ndn::time::seconds(0.05), ndn::bind(&TestSet2::createSyncSocket2, &testSet2));
   uint32_t num[5] = {0, 1, 2, 3, 4};
   string data0((const char *) num, sizeof(num));
-  scheduler.scheduleEvent(ndn::time::seconds(0.10), ndn::bind(&TestSet2::publishSocket1, &testSet2, 0, data0));
+  scheduler.scheduleEvent(ndn::time::seconds(0.10), ndn::bind(&TestSet2::publishSocket1, &testSet2, data0));
   scheduler.scheduleEvent(ndn::time::seconds(0.15), ndn::bind(&TestSet2::setSocket1, &testSet2, (const char *) num, sizeof (num)));
   scheduler.scheduleEvent(ndn::time::seconds(1.00), ndn::bind(&TestSet2::check, &testSet2, 10));
   uint32_t newNum[5] = {9, 7, 2, 1, 1};
   string data1((const char *) newNum, sizeof(newNum));
-  scheduler.scheduleEvent(ndn::time::seconds(1.10), ndn::bind(&TestSet2::publishSocket2, &testSet2, 0, data1));
+  scheduler.scheduleEvent(ndn::time::seconds(1.10), ndn::bind(&TestSet2::publishSocket2, &testSet2, data1));
   scheduler.scheduleEvent(ndn::time::seconds(1.15), ndn::bind(&TestSet2::setSocket2, &testSet2, (const char *) newNum, sizeof (newNum)));
   scheduler.scheduleEvent(ndn::time::seconds(2.00), ndn::bind(&TestSet2::check, &testSet2, 30));
   scheduler.scheduleEvent(ndn::time::seconds(7.00), ndn::bind(&TestSet2::done, &testSet2));
