code: function TcpClientError (err) {
      var svcopts   = this.svcopts;  // make objec info visible inside timer handler
      var controller= this.controller;
      var gateway   = this.controller.gateway;
      var svc       = this.controller.svc;
      
      this.controller.Debug (2,"[%s] connection err=%s", this.uid, err);
      this.end();
      this.adapter.ClientQuit(this);
      setTimeout (function(){ // wait for timeout and recreate a new Object from scratch
          gateway.controllers [svc] = new Controller (gateway, svcopts, svc);
      }, this.svcopts.timeout*1000);
  }
docs: Remote server close connection