code: private static String serializeProtocol(ProtocolHeader header, Protocol protocol) throws JsonGenerationException, JsonMappingException, IOException{
          ProtocolPair p = new ProtocolPair();
          p.setProtocolHeader(header);
          if(protocol == null){
              p.setType(null);
          } else {
              p.setType(protocol.getClass());
          }
          p.setProtocol(toJsonStr(protocol));
          return toJsonStr(p);
      }
docs: Serialize the Protocol to JSON String.
  
  @param header
  the ProtocolHeader.
  @param protocol
  the Protocol.
  @return
  the JSON String.
  @throws JsonGenerationException
  @throws JsonMappingException
  @throws IOException