test for tunnel
diff --git a/include/ccnx-closure.h b/include/ccnx-closure.h
index a2c8b7d..66f79e8 100644
--- a/include/ccnx-closure.h
+++ b/include/ccnx-closure.h
@@ -21,7 +21,7 @@
 
   typedef boost::function<TimeoutCallbackReturnValue (const Name &)> TimeoutCallback;
 
-  Closure(int retry, const DataCallback &dataCallback, const TimeoutCallback &timeoutCallback);
+  Closure(int retry, const DataCallback &dataCallback, const TimeoutCallback &timeoutCallback = TimeoutCallback());
   Closure(const Closure &other);
   int getRetry() {return m_retry;}
   void decRetry() { m_retry--;}
diff --git a/include/ccnx-tunnel.h b/include/ccnx-tunnel.h
index 732370d..0525458 100644
--- a/include/ccnx-tunnel.h
+++ b/include/ccnx-tunnel.h
@@ -85,7 +85,7 @@
 class TunnelClosure : public Closure
 {
 public:
-  TunnelClosure(int retry, const DataCallback &dataCallback, const TimeoutCallback &timeoutCallback, CcnxTunnel *tunnel, const Name &originalInterest);
+  TunnelClosure(int retry, const DataCallback &dataCallback, CcnxTunnel *tunnel, const Name &originalInterest, const TimeoutCallback &timeoutCallback = TimeoutCallback());
 
   TunnelClosure(const Closure *closure, CcnxTunnel *tunnel, const Name &originalInterest);
 
diff --git a/src/ccnx-tunnel.cpp b/src/ccnx-tunnel.cpp
index 49e28af..9406474 100644
--- a/src/ccnx-tunnel.cpp
+++ b/src/ccnx-tunnel.cpp
@@ -55,6 +55,7 @@
 CcnxTunnel::publishContentObject(const Name &name, const Bytes &contentObject, int freshness)
 {
   Name tunneledName = m_localPrefix + name;
+  cout << "Outer name " << tunneledName;
   Bytes tunneledCo = createContentObject(tunneledName, head(contentObject), contentObject.size(), freshness);
   return putToCcnd(tunneledCo);
 }
@@ -115,7 +116,7 @@
   m_rit.erase(prefix);
 }
 
-TunnelClosure::TunnelClosure(int retry, const DataCallback &dataCallback, const TimeoutCallback &timeoutCallback, CcnxTunnel *tunnel, const Name &originalInterest)
+TunnelClosure::TunnelClosure(int retry, const DataCallback &dataCallback, CcnxTunnel *tunnel, const Name &originalInterest, const TimeoutCallback &timeoutCallback)
                   : Closure(retry, dataCallback, timeoutCallback)
                   , m_tunnel(tunnel)
                   , m_originalInterest(originalInterest)
diff --git a/test/test-ccnx-tunnel.cc b/test/test-ccnx-tunnel.cc
new file mode 100644
index 0000000..fc1214a
--- /dev/null
+++ b/test/test-ccnx-tunnel.cc
@@ -0,0 +1,83 @@
+#include "ccnx-tunnel.h"
+#include "ccnx-closure.h"
+#include "ccnx-name.h"
+#include "ccnx-pco.h"
+#include <unistd.h>
+
+#include <boost/test/unit_test.hpp>
+
+
+using namespace Ccnx;
+using namespace std;
+using namespace boost;
+
+BOOST_AUTO_TEST_SUITE(CcnxTunnelTests)
+
+class DummyTunnel : public CcnxTunnel
+{
+public:
+  DummyTunnel();
+  virtual ~DummyTunnel() {}
+
+  virtual Name
+  queryRoutableName(const Name &name);
+
+};
+
+DummyTunnel::DummyTunnel() : CcnxTunnel() {m_localPrefix = Name("/");}
+
+Name
+DummyTunnel::queryRoutableName (const Name &name)
+{
+  return Name("/local") + name;
+}
+
+CcnxWrapperPtr t1(new DummyTunnel());
+CcnxWrapperPtr t2(new DummyTunnel());
+CcnxWrapperPtr c1(new CcnxWrapper());
+
+// global data callback counter;
+int g_dc_i = 0;
+int g_dc_o = 0;
+
+void innerCallback(const Name &name, const Bytes &content)
+{
+  g_dc_i ++;
+  string str((const char *)&content[0], content.size());
+  BOOST_CHECK_EQUAL(name, str);
+}
+
+void outerCallback(const Name &name, const Bytes &content)
+{
+  g_dc_o ++;
+}
+
+
+
+BOOST_AUTO_TEST_CASE (CcnxTunnelTest)
+{
+  // test publish
+  string inner = "/hello";
+
+  g_dc_o = 0;
+  t1->publishData(Name(inner), (const unsigned char *)inner.c_str(), inner.size(), 5);
+  usleep(100000);
+  Closure *outerClosure = new Closure(1, bind(outerCallback, _1, _2));
+  c1->sendInterest(Name("/local/hello"), outerClosure);
+  usleep(100000);
+  // it is indeed published as /local/hello
+  BOOST_CHECK_EQUAL(g_dc_o, 1);
+
+  g_dc_i = 0;
+  Closure *innerClosure = new Closure(1, bind(innerCallback, _1, _2));
+  t2->sendInterest(Name(inner), innerClosure);
+  usleep(100000);
+  BOOST_CHECK_EQUAL(g_dc_i, 1);
+
+  delete outerClosure;
+  delete innerClosure;
+
+}
+
+
+BOOST_AUTO_TEST_SUITE_END()