Need to reopen browser if it was unexpectedly closed during auto-tests
<p>I'm new in Java and have one important question.
So I have a Java Frame with button "Start Tests", On btn click -> chromedriver is initialized and tests are being started in Chrome. In case when browser window is closed but Frame is still opened/visible - I would like to click "Run Tests" once again and get browser window opened again. 
But seems when closing the Browser window - Browser session ID is not valid any more and I've got an Exception: <strong>Chrome not reachable.</strong> (Session info: chrome=49.0.2623.23) (Driver info: chromedriver=2.15.322448, platform=Windows NT 6.1 SP1 x86_64)<br>
System info: host: ip: '192.168.69.3', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_55'
Session ID: 934535b637b44a82c3482cc2b58471d6
Driver info: org.openqa.selenium.chrome.ChromeDriver</p>

<p>This is my class for initialize webDriver:  </p>

<pre><code>public class TestBase {
  public static WebDriver driver = null;

public static WebDriver getDriver() {
        if (driver == null) {
           if (Config.getProperty("browser").equalsIgnoreCase("Chrome")) {

           File fileChrome = new File("src//test/java/chromedriver.exe");
            System.setProperty("webdriver.chrome.driver", fileChrome.getAbsolutePath());
            DesiredCapabilities chrome = DesiredCapabilities.chrome();

            try {
                driver = new ChromeDriver(chrome);
            } catch (Exception e) {
                throw new RuntimeException(e);
                }

            } else {
            System.out.println("Can't get any browser");
          }
       }
    return driver;
}
</code></pre>

<p>And this is how I call this method in tests:</p>

<pre><code>login = PageFactory.initElements(TestBase.getDriver(), Login.class);        
login.test1();
</code></pre>

<p>I have opinion that I need to generate a unique session ID in the beginning of tests, and kill it in the end. Or may be should I do the check if Chrome is opened, and if no - start driver again, IDK.
Please help me with solving this or advice something. I will appreciate any of your help or advice. Thanks</p>