title: Selenium :UnreachableBrowserException is shown in chromeDriver with testNG
body: <p>When I run the following code, below error is showing : org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.</p>
  
  <p>The chrome browser is not getting launched.</p>
  
  <p>//baseClass.java:</p>
  
  <p>public class BaseClass {</p>
  
  <pre><code>//ThreadLocal will keep local copy of driver
  public static ThreadLocal&lt;RemoteWebDriver&gt; dr = new ThreadLocal&lt;RemoteWebDriver&gt;();
  
  @BeforeTest
  //Parameter will get browser from testng.xml on which browser test to run
  @Parameters("myBrowser")
  public void beforeClass(String myBrowser) throws MalformedURLException{
      try {
          RemoteWebDriver driver = null;
  
          if(myBrowser.equals("chrome")){
              DesiredCapabilities capability = new DesiredCapabilities().chrome();
              capability.setBrowserName("chrome");
              capability.setPlatform(Platform.WINDOWS);
              driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);
          }
          else if(myBrowser.equals("firefox")){
              DesiredCapabilities capability = new DesiredCapabilities().firefox();
              capability.setBrowserName("firefox");
              capability.setPlatform(Platform.WINDOWS);
              driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);
          }
  
          //setting webdriver
          setWebDriver(driver);
  
          getDriver().manage().window().maximize();
          getDriver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
      }catch (Exception ex){
          System.out.println(ex.toString());
      }
  }
  
  public WebDriver getDriver() {
      return dr.get();
  }
  
  public void setWebDriver(RemoteWebDriver driver) {
      dr.set(driver);
  }
  
  @AfterClass
  public void afterClass(){
      getDriver().quit();
      dr.set(null);
  
  }
  </code></pre>
  
  <p>}</p>