code: function registerEndpoint(url, handler) {
          tchannel.register(url, function (req, res, arg2, arg3) {
  
              self.middlewareStack.run(req, arg2, arg3,
                  function(req, arg2, arg3, callback) {
                      handler(arg2, arg3, req.remoteAddr, callback);
                  },
                  function(req, err, res1, res2) {
                      res.headers.as = 'raw';
                      if (err) {
                          res.sendNotOk(null, JSON.stringify(err));
                      } else {
                          if (res2 && !Buffer.isBuffer(res2)) {
                              res2 = new Buffer(res2);
                          }
  
                          res.sendOk(res1, res2);
                      }
                  });
  
          });
      }
docs: Wraps endpoint handler so that it doesn't have to know TChannel req/res API.