title: Unable to connect to the remote server error using ChromeDriver v2.22.0
body: <p>I have seen some answers about this subject but were from a couple of years ago and the answer revolved around using a localhost and or using selenium server which I am not doing either. </p>
  
  <p>I am using a combination of SpecFlow, Selenium, and NUnit for my automation project.  I use the ReSharper Unit Test Explorer which runs the SpecFlow scenarios.  </p>
  
  <p>The test scenario I currently have is filling out text fields and saving the entry.</p>
  
  <p>There is an AfterScenario that gets ran after each scenario that performs Driver.Quit() and it appears that the instance is destroyed then reinitialized as the next scenario runs. </p>
  
  <p>I can run the scenarios individually and they run perfectly fine. The is comes when I attempt to run the scenarios as a collection, where one runs after another. The tests that run are the same text entry scenarios and the first scenario runs successfully but when the second scenario gets to the first text entry field, this error occurs.  </p>
  
  <p>(note: I am not running these tests on a local host, they are being ran in a development environment)</p>
  
  <p>Additional information: Unexpected error. System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it [::1]:63961</p>
  
  <p>at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)</p>
  
  <p>at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket&amp; socket, IPAddress&amp; address, ConnectSocketState state, IAsyncResult asyncResult, Exception&amp; exception)</p>
  
  <p>Code:</p>
  
  <pre><code>    class EliteLoginSteps
  public EliteTest newTest; 
      [BeforeScenario()]                                                 
      public void Setup()
      {
         if (newTest == null)
          {
              newTest = new EliteTest();
              newTest.Init();
          }
          else
          {
              newTest.Cleanup();
          }         
      }                        
      [AfterScenario()]
      public void PostTestTearDown()
          {
              newTest.Cleanup();
              Console.WriteLine("Test Complete");
          }
  
      EliteTest class
          public void Init()
          {
          //init driver
          Driver.Initialize();
          }
          public void Cleanup()
          {
          Driver.Close()
          }
  
      Driver class
          public static IWebDriver Instance { get; set; }
          public static void Initialize()
          {
              //set browser driver type
              switch (TestManager.EnvironmentBrowserType.ToLower())
              {
                  case ("chrome"):                    
                      Instance = new ChromeDriver();
                      break;
                  case ("ie"):
                      Instance = new InternetExplorerDriver();
                      break;
                  case ("firefox"):
                      Instance = new FirefoxDriver();
                      break;
                  default:
                      Instance = new FirefoxDriver();
                      break;
              }
          }
          public static void Close()
              {
                  Instance.Quit();
              }
  </code></pre>