spec/shared/setup.js
function setup(connection, done) {
  var config = createDefaultConfig(),
      options = {
        proxy: false,
        headers: {}
      };

  // reset the global variable with handles to port numbers
  handles = {};

  if (connection !== 'direct') {
    options.proxy = true;
 
    config.proxy.gateway = {
      protocol: 'http:',
      host: 'localhost',
      port: 0,
      auth: 'proxyuser:C0mp13x_!d0rd$$@P!'
    };

    // optionally test a non-RFC proxy that expects explicit values
    // for the  Via and/or Host request headers
    if (connection === 'non-rfc-proxy') {
      config.proxy.headers['Via'] = 'http://jedi.example.com';
      config.proxy.headers['Host'] = 'force.example.com';
    }

    // the config map will be mutated by the json-proxy library, so clone it
    options.headers = require('util')._extend(config.proxy.headers);

    configureLanProxy(options, config, function() {
      configureNock(options, config);
      configureExpress(config, done);
    })
  } else {
    configureNock(options, config);
    configureExpress(config, done);
  }
}
function setup(connection, done) {
  var config = createDefaultConfig(),
      options = {
        proxy: false,
        headers: {}
      };

  // reset the global variable with handles to port numbers
  handles = {};

  if (connection !== 'direct') {
    options.proxy = true;
 
    config.proxy.gateway = {
      protocol: 'http:',
      host: 'localhost',
      port: 0,
      auth: 'proxyuser:C0mp13x_!d0rd$$@P!'
    };

    // optionally test a non-RFC proxy that expects explicit values
    // for the  Via and/or Host request headers
    if (connection === 'non-rfc-proxy') {
      config.proxy.headers['Via'] = 'http://jedi.example.com';
      config.proxy.headers['Host'] = 'force.example.com';
    }

    // the config map will be mutated by the json-proxy library, so clone it
    options.headers = require('util')._extend(config.proxy.headers);

    configureLanProxy(options, config, function() {
      configureNock(options, config);
      configureExpress(config, done);
    })
  } else {
    configureNock(options, config);
    configureExpress(config, done);
  }
}
Initializes the testing infrastructure needed for
verifying the behavior of the core proxy library -
nock, express, and httpServer.

@param  {String}   connection one of 'direct', 'proxy', or 'non-rfc-proxy'
@param  {Function} done    the async callback