docs: function Agent(options) {
    if (!(this instanceof Agent)) return new Agent(options);
  
    EventEmitter.call(this);
  
    this.defaultPort = 80;
    this.protocol    = 'http:';
  
    this.options = util._extend({}, options);
    // don't confuse net and make it think that we're connecting to a pipe
    this.options.path = null;
  
    this.requests    = {};
    this.sockets     = {};
    this.freeSockets = {};
  
    this.keepAliveMsecs = this.options.keepAliveMsecs || 1000;
    this.keepAlive      = this.options.keepAlive || false;
  
    this.maxSockets     = this.options.maxSockets || Agent.defaultMaxSockets;
    this.maxFreeSockets = this.options.maxFreeSockets || 256;
  
    var self = this;
    this.on('free', function(socket, options) {
      var name = self.getName(options);
      debug('agent.on(free)', name);
  
      if (!self.isSocketDestroyed(socket) && self.requests[name] && self.requests[name].length) {
        self.requests[name].shift().onSocket(socket);
        if (self.requests[name].length === 0) {
          // don't leak
          delete self.requests[name];
        }
      }
      else {
        // If there are no pending requests, then put it in
        // the freeSockets pool, but only if we're allowed to do so.
        var req = socket._httpMessage;
        if (req && req.shouldKeepAlive && !self.isSocketDestroyed(socket) && self.options.keepAlive) {
          var freeSockets = self.freeSockets[name];
          var freeLen     = freeSockets ? freeSockets.length : 0;
          var count       = freeLen;
  
          if (self.sockets[name]) count += self.sockets[name].length;
  
          debug('potentially pooling', freeLen, count);
  
          if (count > self.maxSockets || freeLen >= self.maxFreeSockets) {
            debug('destroying socket', name);
            self.removeSocket(socket, options);
            socket.destroy();
          } else {
            debug('pooling socket', name);
            freeSockets = freeSockets || [];
            self.freeSockets[name] = freeSockets;
            socket.setKeepAlive(true, self.keepAliveMsecs);
  
            if (socket.unref) {
              socket.unref();
            }
            else if (socket.socket &&
                     socket.socket._handle &&
                     socket.socket._handle.unref) {
              socket.socket._handle.unref();
            }
  
            socket._httpMessage = null;
            self.removeSocket(socket, options);
            freeSockets.push(socket);
  
            // set timeout on idle sockets
            if (options.keepAliveTimeoutMsecs !== undefined) {
              socket._yakaa_timeout = setTimeout(function () {
                self.emit('yakaa_destroy');
                socket.destroySoon();
              }, options.keepAliveTimeoutMsecs);
            }
  
          }
        } else {
          self.removeSocket(socket, options);
          socket.destroy();
        }
      }
    });
  }