diff --git a/tests/face/tcp.cpp b/tests/face/tcp.cpp
index 6fe74e4..b98107e 100644
--- a/tests/face/tcp.cpp
+++ b/tests/face/tcp.cpp
@@ -38,16 +38,16 @@
   void
   channel1_onFaceCreated(const shared_ptr<Face>& newFace)
   {
-    BOOST_CHECK(!static_cast<bool>(m_face1));
-    m_face1 = newFace;
-    m_face1->onReceiveInterest +=
+    BOOST_CHECK(!static_cast<bool>(face1));
+    face1 = newFace;
+    face1->onReceiveInterest +=
       bind(&EndToEndFixture::face1_onReceiveInterest, this, _1);
-    m_face1->onReceiveData +=
+    face1->onReceiveData +=
       bind(&EndToEndFixture::face1_onReceiveData, this, _1);
-    m_face1->onFail +=
+    face1->onFail +=
       bind(&EndToEndFixture::face1_onFail, this);
 
-    m_limitedIo.afterOp();
+    limitedIo.afterOp();
   }
 
   void
@@ -55,45 +55,45 @@
   {
     BOOST_CHECK_MESSAGE(false, reason);
 
-    m_limitedIo.afterOp();
+    limitedIo.afterOp();
   }
 
   void
   face1_onReceiveInterest(const Interest& interest)
   {
-    m_face1_receivedInterests.push_back(interest);
+    face1_receivedInterests.push_back(interest);
 
-    m_limitedIo.afterOp();
+    limitedIo.afterOp();
   }
 
   void
   face1_onReceiveData(const Data& data)
   {
-    m_face1_receivedDatas.push_back(data);
+    face1_receivedDatas.push_back(data);
 
-    m_limitedIo.afterOp();
+    limitedIo.afterOp();
   }
 
   void
   face1_onFail()
   {
-    m_face1.reset();
-    m_limitedIo.afterOp();
+    face1.reset();
+    limitedIo.afterOp();
   }
 
   void
   channel2_onFaceCreated(const shared_ptr<Face>& newFace)
   {
-    BOOST_CHECK(!static_cast<bool>(m_face2));
-    m_face2 = newFace;
-    m_face2->onReceiveInterest +=
+    BOOST_CHECK(!static_cast<bool>(face2));
+    face2 = newFace;
+    face2->onReceiveInterest +=
       bind(&EndToEndFixture::face2_onReceiveInterest, this, _1);
-    m_face2->onReceiveData +=
+    face2->onReceiveData +=
       bind(&EndToEndFixture::face2_onReceiveData, this, _1);
-    m_face2->onFail +=
+    face2->onFail +=
       bind(&EndToEndFixture::face2_onFail, this);
 
-    m_limitedIo.afterOp();
+    limitedIo.afterOp();
   }
 
   void
@@ -101,37 +101,37 @@
   {
     BOOST_CHECK_MESSAGE(false, reason);
 
-    m_limitedIo.afterOp();
+    limitedIo.afterOp();
   }
 
   void
   face2_onReceiveInterest(const Interest& interest)
   {
-    m_face2_receivedInterests.push_back(interest);
+    face2_receivedInterests.push_back(interest);
 
-    m_limitedIo.afterOp();
+    limitedIo.afterOp();
   }
 
   void
   face2_onReceiveData(const Data& data)
   {
-    m_face2_receivedDatas.push_back(data);
+    face2_receivedDatas.push_back(data);
 
-    m_limitedIo.afterOp();
+    limitedIo.afterOp();
   }
 
   void
   face2_onFail()
   {
-    m_face2.reset();
-    m_limitedIo.afterOp();
+    face2.reset();
+    limitedIo.afterOp();
   }
 
   void
   channel_onFaceCreated(const shared_ptr<Face>& newFace)
   {
-    m_faces.push_back(newFace);
-    m_limitedIo.afterOp();
+    faces.push_back(newFace);
+    limitedIo.afterOp();
   }
 
   void
@@ -139,26 +139,26 @@
   {
     BOOST_CHECK_MESSAGE(false, reason);
 
-    m_limitedIo.afterOp();
+    limitedIo.afterOp();
   }
 
   void
   checkFaceList(size_t shouldBe)
   {
-    BOOST_CHECK_EQUAL(m_faces.size(), shouldBe);
+    BOOST_CHECK_EQUAL(faces.size(), shouldBe);
   }
 
 public:
-  LimitedIo m_limitedIo;
+  LimitedIo limitedIo;
 
-  shared_ptr<Face> m_face1;
-  std::vector<Interest> m_face1_receivedInterests;
-  std::vector<Data> m_face1_receivedDatas;
-  shared_ptr<Face> m_face2;
-  std::vector<Interest> m_face2_receivedInterests;
-  std::vector<Data> m_face2_receivedDatas;
+  shared_ptr<Face> face1;
+  std::vector<Interest> face1_receivedInterests;
+  std::vector<Data> face1_receivedDatas;
+  shared_ptr<Face> face2;
+  std::vector<Interest> face2_receivedInterests;
+  std::vector<Data> face2_receivedDatas;
 
-  std::list< shared_ptr<Face> > m_faces;
+  std::list< shared_ptr<Face> > faces;
 };
 
 
@@ -180,23 +180,24 @@
                      bind(&EndToEndFixture::channel2_onFaceCreated, this, _1),
                      bind(&EndToEndFixture::channel2_onConnectFailed, this, _1));
 
-  BOOST_CHECK_MESSAGE(m_limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
+  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
                       "TcpChannel error: cannot connect or cannot accept connection");
 
-  BOOST_REQUIRE(static_cast<bool>(m_face1));
-  BOOST_REQUIRE(static_cast<bool>(m_face2));
+  BOOST_REQUIRE(static_cast<bool>(face1));
+  BOOST_REQUIRE(static_cast<bool>(face2));
 
-  BOOST_CHECK(m_face1->isOnDemand());
-  BOOST_CHECK(!m_face2->isOnDemand());
+  BOOST_CHECK(face1->isOnDemand());
+  BOOST_CHECK(!face2->isOnDemand());
 
-  BOOST_CHECK_EQUAL(m_face2->getUri().toString(), "tcp4://127.0.0.1:20070");
-  // face1 has an unknown URI, since the source port is automatically chosen by OS
+  BOOST_CHECK_EQUAL(face2->getRemoteUri().toString(), "tcp4://127.0.0.1:20070");
+  BOOST_CHECK_EQUAL(face1->getLocalUri().toString(), "tcp4://127.0.0.1:20070");
+  // face1 has an unknown remoteUri, since the source port is automatically chosen by OS
 
-  BOOST_CHECK_EQUAL(m_face1->isLocal(), true);
-  BOOST_CHECK_EQUAL(m_face2->isLocal(), true);
+  BOOST_CHECK_EQUAL(face1->isLocal(), true);
+  BOOST_CHECK_EQUAL(face2->isLocal(), true);
 
-  BOOST_CHECK_EQUAL(static_cast<bool>(dynamic_pointer_cast<LocalFace>(m_face1)), true);
-  BOOST_CHECK_EQUAL(static_cast<bool>(dynamic_pointer_cast<LocalFace>(m_face2)), true);
+  BOOST_CHECK_EQUAL(static_cast<bool>(dynamic_pointer_cast<LocalFace>(face1)), true);
+  BOOST_CHECK_EQUAL(static_cast<bool>(dynamic_pointer_cast<LocalFace>(face2)), true);
 
   // integrated tests needs to check that TcpFace for non-loopback fails these tests...
 
@@ -214,36 +215,36 @@
   data1.setSignature(fakeSignature);
   data2.setSignature(fakeSignature);
 
-  m_face1->sendInterest(interest1);
-  m_face1->sendInterest(interest1);
-  m_face1->sendInterest(interest1);
-  m_face1->sendData    (data1    );
-  m_face2->sendInterest(interest2);
-  m_face2->sendData    (data2    );
-  m_face2->sendData    (data2    );
-  m_face2->sendData    (data2    );
+  face1->sendInterest(interest1);
+  face1->sendInterest(interest1);
+  face1->sendInterest(interest1);
+  face1->sendData    (data1    );
+  face2->sendInterest(interest2);
+  face2->sendData    (data2    );
+  face2->sendData    (data2    );
+  face2->sendData    (data2    );
 
-  BOOST_CHECK_MESSAGE(m_limitedIo.run(8, time::seconds(10)) == LimitedIo::EXCEED_OPS,
+  BOOST_CHECK_MESSAGE(limitedIo.run(8, time::seconds(10)) == LimitedIo::EXCEED_OPS,
                       "TcpChannel error: cannot send or receive Interest/Data packets");
 
 
-  BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 1);
-  BOOST_REQUIRE_EQUAL(m_face1_receivedDatas    .size(), 3);
-  BOOST_REQUIRE_EQUAL(m_face2_receivedInterests.size(), 3);
-  BOOST_REQUIRE_EQUAL(m_face2_receivedDatas    .size(), 1);
+  BOOST_REQUIRE_EQUAL(face1_receivedInterests.size(), 1);
+  BOOST_REQUIRE_EQUAL(face1_receivedDatas    .size(), 3);
+  BOOST_REQUIRE_EQUAL(face2_receivedInterests.size(), 3);
+  BOOST_REQUIRE_EQUAL(face2_receivedDatas    .size(), 1);
 
-  BOOST_CHECK_EQUAL(m_face1_receivedInterests[0].getName(), interest2.getName());
-  BOOST_CHECK_EQUAL(m_face1_receivedDatas    [0].getName(), data2.getName());
-  BOOST_CHECK_EQUAL(m_face2_receivedInterests[0].getName(), interest1.getName());
-  BOOST_CHECK_EQUAL(m_face2_receivedDatas    [0].getName(), data1.getName());
+  BOOST_CHECK_EQUAL(face1_receivedInterests[0].getName(), interest2.getName());
+  BOOST_CHECK_EQUAL(face1_receivedDatas    [0].getName(), data2.getName());
+  BOOST_CHECK_EQUAL(face2_receivedInterests[0].getName(), interest1.getName());
+  BOOST_CHECK_EQUAL(face2_receivedDatas    [0].getName(), data1.getName());
 
-  const FaceCounters& counters1 = m_face1->getCounters();
+  const FaceCounters& counters1 = face1->getCounters();
   BOOST_CHECK_EQUAL(counters1.getInInterest() , 1);
   BOOST_CHECK_EQUAL(counters1.getInData()     , 3);
   BOOST_CHECK_EQUAL(counters1.getOutInterest(), 3);
   BOOST_CHECK_EQUAL(counters1.getOutData()    , 1);
 
-  const FaceCounters& counters2 = m_face2->getCounters();
+  const FaceCounters& counters2 = face2->getCounters();
   BOOST_CHECK_EQUAL(counters2.getInInterest() , 3);
   BOOST_CHECK_EQUAL(counters2.getInData()     , 1);
   BOOST_CHECK_EQUAL(counters2.getOutInterest(), 1);
@@ -264,20 +265,21 @@
                      bind(&EndToEndFixture::channel2_onFaceCreated, this, _1),
                      bind(&EndToEndFixture::channel2_onConnectFailed, this, _1));
 
-  BOOST_CHECK_MESSAGE(m_limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
+  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
                       "TcpChannel error: cannot connect or cannot accept connection");
 
-  BOOST_REQUIRE(static_cast<bool>(m_face1));
-  BOOST_REQUIRE(static_cast<bool>(m_face2));
+  BOOST_REQUIRE(static_cast<bool>(face1));
+  BOOST_REQUIRE(static_cast<bool>(face2));
 
-  BOOST_CHECK_EQUAL(m_face2->getUri().toString(), "tcp6://[::1]:20070");
-  // face1 has an unknown URI, since the source port is automatically chosen by OS
+  BOOST_CHECK_EQUAL(face2->getRemoteUri().toString(), "tcp6://[::1]:20070");
+  BOOST_CHECK_EQUAL(face1->getLocalUri().toString(), "tcp6://[::1]:20070");
+  // face1 has an unknown remoteUri, since the source port is automatically chosen by OS
 
-  BOOST_CHECK_EQUAL(m_face1->isLocal(), true);
-  BOOST_CHECK_EQUAL(m_face2->isLocal(), true);
+  BOOST_CHECK_EQUAL(face1->isLocal(), true);
+  BOOST_CHECK_EQUAL(face2->isLocal(), true);
 
-  BOOST_CHECK_EQUAL(static_cast<bool>(dynamic_pointer_cast<LocalFace>(m_face1)), true);
-  BOOST_CHECK_EQUAL(static_cast<bool>(dynamic_pointer_cast<LocalFace>(m_face2)), true);
+  BOOST_CHECK_EQUAL(static_cast<bool>(dynamic_pointer_cast<LocalFace>(face1)), true);
+  BOOST_CHECK_EQUAL(static_cast<bool>(dynamic_pointer_cast<LocalFace>(face2)), true);
 
   // integrated tests needs to check that TcpFace for non-loopback fails these tests...
 
@@ -295,24 +297,24 @@
   data1.setSignature(fakeSignature);
   data2.setSignature(fakeSignature);
 
-  m_face1->sendInterest(interest1);
-  m_face1->sendData    (data1    );
-  m_face2->sendInterest(interest2);
-  m_face2->sendData    (data2    );
+  face1->sendInterest(interest1);
+  face1->sendData    (data1    );
+  face2->sendInterest(interest2);
+  face2->sendData    (data2    );
 
-  BOOST_CHECK_MESSAGE(m_limitedIo.run(4, time::seconds(10)) == LimitedIo::EXCEED_OPS,
+  BOOST_CHECK_MESSAGE(limitedIo.run(4, time::seconds(10)) == LimitedIo::EXCEED_OPS,
                       "TcpChannel error: cannot send or receive Interest/Data packets");
 
 
-  BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 1);
-  BOOST_REQUIRE_EQUAL(m_face1_receivedDatas    .size(), 1);
-  BOOST_REQUIRE_EQUAL(m_face2_receivedInterests.size(), 1);
-  BOOST_REQUIRE_EQUAL(m_face2_receivedDatas    .size(), 1);
+  BOOST_REQUIRE_EQUAL(face1_receivedInterests.size(), 1);
+  BOOST_REQUIRE_EQUAL(face1_receivedDatas    .size(), 1);
+  BOOST_REQUIRE_EQUAL(face2_receivedInterests.size(), 1);
+  BOOST_REQUIRE_EQUAL(face2_receivedDatas    .size(), 1);
 
-  BOOST_CHECK_EQUAL(m_face1_receivedInterests[0].getName(), interest2.getName());
-  BOOST_CHECK_EQUAL(m_face1_receivedDatas    [0].getName(), data2.getName());
-  BOOST_CHECK_EQUAL(m_face2_receivedInterests[0].getName(), interest1.getName());
-  BOOST_CHECK_EQUAL(m_face2_receivedDatas    [0].getName(), data1.getName());
+  BOOST_CHECK_EQUAL(face1_receivedInterests[0].getName(), interest2.getName());
+  BOOST_CHECK_EQUAL(face1_receivedDatas    [0].getName(), data2.getName());
+  BOOST_CHECK_EQUAL(face2_receivedInterests[0].getName(), interest1.getName());
+  BOOST_CHECK_EQUAL(face2_receivedDatas    [0].getName(), data1.getName());
 }
 
 BOOST_FIXTURE_TEST_CASE(MultipleAccepts, EndToEndFixture)
@@ -330,11 +332,11 @@
                     bind(&EndToEndFixture::channel_onConnectFailed, this, _1),
                     time::seconds(4)); // very short timeout
 
-  BOOST_CHECK_MESSAGE(m_limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
+  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
                       "TcpChannel error: cannot connect or cannot accept connection");
 
 
-  BOOST_CHECK_EQUAL(m_faces.size(), 2);
+  BOOST_CHECK_EQUAL(faces.size(), 2);
 
   shared_ptr<TcpChannel> channel3 = factory.createChannel("127.0.0.1", "20072");
   channel3->connect("127.0.0.1", "20070",
@@ -359,11 +361,11 @@
   scheduler::schedule(time::milliseconds(500),
                       bind(&EndToEndFixture::checkFaceList, this, 4));
 
-  BOOST_CHECK_MESSAGE(m_limitedIo.run(4,// 2 connects and 2 accepts
+  BOOST_CHECK_MESSAGE(limitedIo.run(4,// 2 connects and 2 accepts
                       time::seconds(10)) == LimitedIo::EXCEED_OPS,
                       "TcpChannel error: cannot connect or cannot accept multiple connections");
 
-  BOOST_CHECK_EQUAL(m_faces.size(), 6);
+  BOOST_CHECK_EQUAL(faces.size(), 6);
 }
 
 
@@ -382,24 +384,24 @@
                     bind(&EndToEndFixture::channel2_onConnectFailed, this, _1),
                     time::seconds(4)); // very short timeout
 
-  BOOST_CHECK_MESSAGE(m_limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
+  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
                       "TcpChannel error: cannot connect or cannot accept connection");
 
   BOOST_CHECK_EQUAL(channel1->size(), 1);
   BOOST_CHECK_EQUAL(channel2->size(), 1);
 
-  BOOST_REQUIRE(static_cast<bool>(m_face1));
-  BOOST_CHECK(static_cast<bool>(m_face2));
+  BOOST_REQUIRE(static_cast<bool>(face1));
+  BOOST_CHECK(static_cast<bool>(face2));
 
   // Face::close must be invoked during io run to be counted as an op
-  scheduler::schedule(time::milliseconds(100), bind(&Face::close, m_face1));
+  scheduler::schedule(time::milliseconds(100), bind(&Face::close, face1));
 
-  BOOST_CHECK_MESSAGE(m_limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
+  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(10)) == LimitedIo::EXCEED_OPS,
                       "FaceClosing error: cannot properly close faces");
 
   // both faces should get closed
-  BOOST_CHECK(!static_cast<bool>(m_face1));
-  BOOST_CHECK(!static_cast<bool>(m_face2));
+  BOOST_CHECK(!static_cast<bool>(face1));
+  BOOST_CHECK(!static_cast<bool>(face2));
 
   BOOST_CHECK_EQUAL(channel1->size(), 0);
   BOOST_CHECK_EQUAL(channel2->size(), 0);
