title: UnknownError: Connection refused (Connection refused)
body: <p>I'm running a grunt test within a MEAN JS stack app and found an issue that I can't work out its cause.</p>
  
  <p>Running webdriver-manager on its own, i.e. <code>webdriver-manager start</code>, works fine, but running via the grunt <code>test</code> task seems to fail.</p>
  
  <p>I also noticed that the port is different (not 4444). Not sure how to change this either.</p>
  
  <pre class="lang-none prettyprint-override"><code>Running "protractor:e2e" (protractor) task
  webdriver-manager path: /Users/valdy/Development/MeanJSApp/node_modules/protractor/bin/webdriver-manager
  selenium standalone is up to date.
  chromedriver is up to date.
  Starting selenium standalone server...
  [launcher] Running 1 instances of WebDriver
  Selenium standalone server started at http://192.168.0.115:64594/wd/hub
  
  /Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/atoms/error.js:108
    var template = new Error(this.message);
                   ^
  UnknownError: Connection refused (Connection refused)
      at new bot.Error (/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/atoms/error.js:108:18)
      at Object.bot.response.checkResponse (/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/atoms/response.js:109:9)
      at /Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:160:24
      at promise.ControlFlow.runInFrame_ (/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1857:20)
      at wrappedCtr.notify (/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2448:25)
      at promise.Promise.notify_ (/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:564:12)
      at Array.forEach (native)
      at promise.Promise.notifyAll_ (/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:553:15)
      at goog.async.run.processWorkQueue (/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/goog/async/run.js:130:15)
      at process._tickCallback (internal/process/next_tick.js:103:7)
  From: Task: WebDriver.createSession()
      at Function.webdriver.WebDriver.acquireSession_ (/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:157:22)
      at Function.webdriver.WebDriver.createSession (/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:131:30)
      at Builder.build (/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/builder.js:445:22)
      at LocalDriverProvider.DriverProvider.getNewDriver (/Users/valdy/Development/MeanJSApp/node_modules/protractor/lib/driverProviders/driverProvider.js:38:7)
      at Runner.createBrowser (/Users/valdy/Development/MeanJSApp/node_modules/protractor/lib/runner.js:182:37)
      at /Users/valdy/Development/MeanJSApp/node_modules/protractor/lib/runner.js:263:21
      at _fulfilled (/Users/valdy/Development/MeanJSApp/node_modules/q/q.js:797:54)
      at self.promiseDispatch.done (/Users/valdy/Development/MeanJSApp/node_modules/q/q.js:826:30)
      at Promise.promise.promiseDispatch (/Users/valdy/Development/MeanJSApp/node_modules/q/q.js:759:13)
      at /Users/valdy/Development/MeanJSApp/node_modules/q/q.js:573:44
  [launcher] Process exited with error code 1
  &gt;&gt; 
  Warning: Tests failed, protractor exited with code: 1 Use --force to continue.
  
  Aborted due to warnings.
  </code></pre>
  
  <p>This is the config for tests.js (<code>/config/assets/tests.js</code>):</p>
  
  <pre class="lang-js prettyprint-override"><code>'use strict';
  
  module.exports = {
    tests: {
      // client: ['modules/*/tests/client/**/*.js'],
      client: ['modules/forum/tests/client/**/*.js'],
  
  
      // server: ['modules/*/tests/server/**/*.js'],
      server: ['modules/forum/tests/server/**/*.js'],
  
      e2e: ['modules/*/tests/e2e/**/*.js']
      // e2e: ['modules/forum/tests/e2e/**/*.js']  
  
    }
  };
  </code></pre>
  
  <p>I also found that protractor's config.json, under <code>/node_module/protractor/config.json</code> has this configuration:</p>
  
  <pre class="lang-json prettyprint-override"><code>{
      "webdriverVersions": {
          "selenium": "2.47.1",
          "chromedriver": "2.19",
          "iedriver": "2.47.0"
      }
  }
  </code></pre>
  
  <p>And this is my own <code>protractor.config.js</code>, in the root of the web app:</p>
  
  <pre class="lang-js prettyprint-override"><code>'use strict';
  
  // Protractor configuration
  var config = {
      specs: ['modules/*/tests/e2e/*.js']
  };
  
  if (process.env.TRAVIS) {
      config.capabilities = {
          browserName: 'firefox'
      };
  }
  
  exports.config = config;
  </code></pre>
  
  <p>And here is protractor's npm descriptor (<code>/node_module/protractor/package.json</code>):</p>
  
  <pre class="lang-json prettyprint-override"><code>{
      "_args": [
          [
              {
                  "raw": "Protractor@2.5.1",
                  "scope": null,
                  "escapedName": "Protractor",
                  "name": "Protractor",
                  "rawSpec": "2.5.1",
                  "spec": "2.5.1",
                  "type": "version"
              },
              "/Users/valdy/Development/MeanJSApp"
          ]
      ],
      "_from": "Protractor@2.5.1",
      "_id": "protractor@2.5.1",
      "_inCache": true,
      "_location": "/protractor",
      "_nodeVersion": "0.12.7",
      "_npmUser": {
          "name": "angularcore",
          "email": "angular-core+npm@google.com"
      },
      "_npmVersion": "2.11.3",
      "_phantomChildren": {
          "boom": "2.10.1",
          "chalk": "1.1.3",
          "combined-stream": "1.0.5",
          "core-util-is": "1.0.2",
          "cryptiles": "2.0.5",
          "ctype": "0.5.3",
          "forever-agent": "0.6.1",
          "graceful-readlink": "1.0.1",
          "hoek": "2.16.3",
          "inherits": "2.0.3",
          "is-my-json-valid": "2.16.0",
          "isstream": "0.1.2",
          "json-stringify-safe": "5.0.1",
          "lru-cache": "2.7.3",
          "oauth-sign": "0.8.2",
          "sigmund": "1.0.1",
          "sntp": "1.0.9",
          "string_decoder": "0.10.31",
          "stringstream": "0.0.5",
          "tough-cookie": "2.3.2"
      },
      "_requested": {
          "raw": "Protractor@2.5.1",
          "scope": null,
          "escapedName": "Protractor",
          "name": "Protractor",
          "rawSpec": "2.5.1",
          "spec": "2.5.1",
          "type": "version"
      },
      "_requiredBy": [
          "#USER",
          "/grunt-protractor-runner",
          "/gulp-protractor"
      ],
      "_resolved": "https://registry.npmjs.org/protractor/-/protractor-2.5.1.tgz",
      "_shasum": "03d6c93cd7c268f4250177d55a2fec8a198372cd",
      "_shrinkwrap": null,
      "_spec": "Protractor@2.5.1",
      "_where": "/Users/valdy/Development/MeanJSApp",
      "author": {
          "name": "Julie Ralph",
          "email": "ju.ralph@gmail.com"
      },
      "bin": {
          "protractor": "bin/protractor",
          "webdriver-manager": "bin/webdriver-manager"
      },
      "bugs": {
          "url": "https://github.com/angular/protractor/issues"
      },
      "dependencies": {
          "accessibility-developer-tools": "~2.6.0",
          "adm-zip": "0.4.4",
          "glob": "~3.2",
          "html-entities": "~1.1.1",
          "jasmine": "2.3.2",
          "jasminewd": "1.1.0",
          "jasminewd2": "0.0.6",
          "lodash": "~2.4.1",
          "minijasminenode": "1.1.1",
          "optimist": "~0.6.0",
          "q": "1.0.0",
          "request": "~2.57.0",
          "saucelabs": "~1.0.1",
          "selenium-webdriver": "2.47.0",
          "source-map-support": "~0.2.6"
      },
      "description": "Webdriver E2E test wrapper for Angular.",
      "devDependencies": {
          "chai": "~3.3.0",
          "chai-as-promised": "~5.1.0",
          "cucumber": "~0.6.0",
          "expect.js": "~0.2.0",
          "express": "~3.3.4",
          "jshint": "2.5.0",
          "mocha": "2.3.3",
          "rimraf": "~2.2.6"
      },
      "directories": {},
      "dist": {
          "shasum": "03d6c93cd7c268f4250177d55a2fec8a198372cd",
          "tarball": "https://registry.npmjs.org/protractor/-/protractor-2.5.1.tgz"
      },
      "gitHead": "645133d557f1059d9e885f2566fc4c29ce7c19cc",
      "homepage": "https://github.com/angular/protractor",
      "keywords": [
          "angular",
          "test",
          "testing",
          "webdriver",
          "webdriverjs",
          "selenium"
      ],
      "license": "MIT",
      "main": "lib/protractor.js",
      "maintainers": [
          {
              "name": "juliemr",
              "email": "ju.ralph@gmail.com"
          },
          {
              "name": "angularcore",
              "email": "angular-core+npm@google.com"
          }
      ],
      "name": "protractor",
      "optionalDependencies": {},
      "readme": "ERROR: No README data found!",
      "repository": {
          "type": "git",
          "url": "git://github.com/angular/protractor.git"
      },
      "scripts": {
          "pretest": "jshint lib spec scripts",
          "start": "node testapp/scripts/web-server.js",
          "test": "node scripts/test.js"
      },
      "version": "2.5.1"
  }
  </code></pre>