code: function() {
          var details = {
              port: args.ports.length ? args.ports[attempt % args.ports.length] : args.ports,
              host: args.hosts.length ? args.hosts[attempt % args.hosts.length] : args.hosts
          };
          attempt++;
          return details;
      }
docs: A function can be specified as the value for a connection_details property on the options passed to connect(). This should return an object defining the connection options to use. Here we use it to alternate between the different ports supplied via command line arguments.