fixed bugs and unittests
diff --git a/tests/unit-tests/ca-module.t.cpp b/tests/unit-tests/ca-module.t.cpp
index 25a5322..104c505 100644
--- a/tests/unit-tests/ca-module.t.cpp
+++ b/tests/unit-tests/ca-module.t.cpp
@@ -24,6 +24,7 @@
 #include "challenge-module.hpp"
 #include "challenge-module/challenge-pin.hpp"
 #include "challenge-module/challenge-email.hpp"
+#include "protocol-detail/info.hpp"
 
 #include <ndn-cxx/util/dummy-client-face.hpp>
 #include <ndn-cxx/security/signing-helpers.hpp>
@@ -73,6 +74,7 @@
   paramTLV.push_back(makeStringBlock(tlv_parameter_key, JSON_CLIENT_PROBE_INFO));
   paramTLV.push_back(makeStringBlock(tlv_parameter_value, "zhiyi"));
   paramTLV.encode();
+
   interest.setApplicationParameters(paramTLV);
 
   int count = 0;
@@ -81,7 +83,11 @@
       BOOST_CHECK(security::verifySignature(response, cert));
       Block contentBlock = response.getContent();
       contentBlock.parse();
-      BOOST_CHECK_EQUAL(readString(contentBlock.get(tlv_ca_prefix)), "/ndn/example");
+      Block probeResponse = contentBlock.get(tlv_probe_response);
+      probeResponse.parse();
+      Name caName;
+      caName.wireDecode(probeResponse.get(tlv::Name));
+      BOOST_CHECK_EQUAL(caName, "/ndn/example");
     });
   face.receive(interest);
 
@@ -109,8 +115,9 @@
   face.onSendData.connect([&] (const Data& response) {
       count++;
       BOOST_CHECK(security::verifySignature(response, cert));
-      auto contentJson = ClientModule::getJsonFromData(response);
-      auto caItem = ClientConfig::extractCaItem(contentJson);
+      auto contentBlock = response.getContent();
+      contentBlock.parse();
+      auto caItem = INFO::decodeClientConfigFromContent(contentBlock);
       BOOST_CHECK_EQUAL(caItem.m_caPrefix, "/ndn");
       BOOST_CHECK_EQUAL(caItem.m_probe, "");
       BOOST_CHECK_EQUAL(caItem.m_anchor.wireEncode(), cert.wireEncode());
@@ -134,16 +141,25 @@
 
   Interest interest("/ndn/CA/PROBE");
   interest.setCanBePrefix(false);
-  JsonSection paramJson;
-  paramJson.add(JSON_CLIENT_PROBE_INFO, "zhiyi");
-  interest.setApplicationParameters(ClientModule::paramFromJson(paramJson));
+
+  Block paramTLV = makeEmptyBlock(tlv::ApplicationParameters);
+  paramTLV.push_back(makeStringBlock(tlv_parameter_key, JSON_CLIENT_PROBE_INFO));
+  paramTLV.push_back(makeStringBlock(tlv_parameter_value, "zhiyi"));
+  paramTLV.encode();
+
+  interest.setApplicationParameters(paramTLV);
 
   int count = 0;
   face.onSendData.connect([&] (const Data& response) {
       count++;
       BOOST_CHECK(security::verifySignature(response, cert));
-      auto contentJson = ClientModule::getJsonFromData(response);
-      BOOST_CHECK(contentJson.get<std::string>(JSON_CA_NAME) != "");
+      auto contentBlock = response.getContent();
+      contentBlock.parse();
+      auto probeResponseBlock = contentBlock.get(tlv_probe_response);
+      probeResponseBlock.parse();
+      Name caPrefix;
+      caPrefix.wireDecode(probeResponseBlock.get(tlv::Name));
+      BOOST_CHECK(caPrefix != "");
     });
   face.receive(interest);
 
@@ -168,19 +184,28 @@
   client.getClientConf().m_caItems.push_back(item);
 
   auto interest = client.generateNewInterest(time::system_clock::now(),
-                                             time::system_clock::now() + time::days(10),
+                                             time::system_clock::now() + time::days(1),
                                              Name("/ndn/zhiyi"));
 
   int count = 0;
   face.onSendData.connect([&] (const Data& response) {
       count++;
       BOOST_CHECK(security::verifySignature(response, cert));
-      auto contentJson = ClientModule::getJsonFromData(response);
-      BOOST_CHECK(contentJson.get<std::string>(JSON_CA_ECDH) != "");
-      BOOST_CHECK(contentJson.get<std::string>(JSON_CA_SALT) != "");
-      BOOST_CHECK(contentJson.get<std::string>(JSON_CA_REQUEST_ID) != "");
-      auto challengesJson = contentJson.get_child(JSON_CA_CHALLENGES);
-      BOOST_CHECK(challengesJson.size() != 0);
+      auto contentBlock = response.getContent();
+      contentBlock.parse();
+
+      BOOST_CHECK(readString(contentBlock.get(tlv_ecdh_pub)) != "");
+      BOOST_CHECK(readString(contentBlock.get(tlv_salt)) != "");
+      BOOST_CHECK(readString(contentBlock.get(tlv_request_id)) != "");
+
+      auto challengeBlockCount = 0;
+      for (auto const& element: contentBlock.elements()) {
+        if (element.type() == tlv_challenge) {
+          challengeBlockCount++;
+        }
+      }
+
+      BOOST_CHECK(challengeBlockCount != 0);
 
       client.onNewResponse(response);
       BOOST_CHECK_EQUAL_COLLECTIONS(client.m_aesKey, client.m_aesKey + sizeof(client.m_aesKey),
@@ -246,7 +271,7 @@
   m_keyChain.sign(*data, signingByIdentity(ca.m_config.m_caPrefix));
 
   auto interest = client.generateNewInterest(time::system_clock::now(),
-                                             time::system_clock::now() + time::days(10),
+                                             time::system_clock::now() + time::days(1),
                                              Name("/ndn/zhiyi"), data);
 
   int count = 0;
@@ -277,7 +302,7 @@
   item.m_anchor = cert;
   client.getClientConf().m_caItems.push_back(item);
   auto newInterest = client.generateNewInterest(time::system_clock::now(),
-                                                time::system_clock::now() + time::days(10), Name("/ndn/zhiyi"));
+                                                time::system_clock::now() + time::days(1), Name("/ndn/zhiyi"));
 
   // generate CHALLENGE Interest
   ChallengePin pinChallenge;
@@ -288,7 +313,6 @@
   int count = 0;
   face.onSendData.connect([&] (const Data& response) {
     if (Name("/ndn/CA/NEW").isPrefixOf(response.getName())) {
-      auto contentJson = ClientModule::getJsonFromData(response);
       client.onNewResponse(response);
       auto paramJson = pinChallenge.getRequirementForChallenge(client.m_status, client.m_challengeStatus);
       challengeInterest = client.generateChallengeInterest(pinChallenge.genChallengeRequestTLV(client.m_status,
diff --git a/tests/unit-tests/client-module.t.cpp b/tests/unit-tests/client-module.t.cpp
index 638820f..888ad6b 100644
--- a/tests/unit-tests/client-module.t.cpp
+++ b/tests/unit-tests/client-module.t.cpp
@@ -61,7 +61,7 @@
   BOOST_CHECK(firstInterest->getName().at(-1).isParametersSha256Digest());
   // ignore the last name component (ParametersSha256Digest)
   BOOST_CHECK_EQUAL(firstInterest->getName().getPrefix(-1), "/site/CA/PROBE");
-  BOOST_CHECK_EQUAL(CaModule::jsonFromBlock(firstInterest->getApplicationParameters()).get<std::string>("email"),
+  BOOST_CHECK_EQUAL(readString(firstInterest->getApplicationParameters().get(tlv_parameter_value)),
                     "zhiyi@cs.ucla.edu");
 }