title: Protractor Not Connecting To Localhost:8080 in Angular 2 App Testing - ERR_CONNECTION_REFUSED
body: <p>I am trying to run my protractor tests but am having some problems connecting to the url I am requesting in my browser.get function call.</p>
  
  <p><strong>protractor.conf.js:</strong></p>
  
  <pre><code>const { SpecReporter } = require('jasmine-spec-reporter');
  
  
  exports.config = {
        framework: 'jasmine',
        allScriptsTimeout: 11000,
        specs: ['./e2e_tests/components/**/*.spec.ts'],
        capabilities: {
            'browserName': 'chrome'
        },
        directConnect: true,
        jasmineNodeOpts: {
            showColors: true,
            defaultTimeoutInterval: 30000,
            print: function() {}
        },
        beforeLaunch: function() {
           require('ts-node').register({
              project: 'e2e_tests/tsconfig.e2e.json'
          });
        },
        onPrepare() {
             jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
           }
   };
  </code></pre>
  
  <p><strong>spec.ts</strong></p>
  
  <pre><code> import { browser, element, by } from 'protractor';
  
   describe('Header Bar Component', function () {
     beforeEach(function () {
          browser.get('http://localhost:8080/#/dashboard');
     });
  
    it('should have a title', function () {
         var headerElement = element(by.tagName('h2'));
         expect(headerElement.getText()).toMatch('Example');
    });
  
    it('should have a menu', function () {
        var menu = element(by.tagName('md-menu'));
        expect(menu).not.toBeFalsy();
   });
  
   it('should have a settings option', function () {
        var menuOption = element(by.buttonText('Settings'));
        expect(menuOption).not.toBeFalsy();
    });
  });
  </code></pre>
  
  <p>I have tried cleaning my browsing history / cache and also restarting my DNS Client in services.msc. Both did not provide a solution. </p>
  
  <p>The "View Site Information" tab in the browser url is saying "Not Secure" when Protractor is trying to load the browser but in the end it says: ERR_CONNECTION_REFUSED</p>
  
  <p>Does anyone know what I'm missing here? Thanks</p>