Here's my code to instantiate the webdriver.
System.setProperty("webdriver.chrome.driver", "D:\chromedriver.exe");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
WebDriver driver = new ChromeDriver(capabilities);
Now, I'd like to get the port on which the chromedriver has been started. I actually am trying to get automation on OpenFin working and it uses RemoteWebDriver to drive their application using a ChromeDriver.
Here's the link to their Git : https://github.com/openfin/hello-openfin-selenium-java-example
The problem I'm facing is, as I myself have to run the tests on a remote machine, with multiple tests running in parallel, I would require the ability to run multiple instances of chromedriver on the remote machine and then pass its URL with the ports to each chromedriver instance to the RemoteWebDriver.