lock.lock(connectTimeout);
try {
delegate = new HttpCommandExecutor(buildUrl(host, determineNextFreePort(profile.getPort())));
String firefoxLogFile = System.getProperty("webdriver.firefox.logfile");
File logFile = firefoxLogFile == null ? null : new File(firefoxLogFile);
this.process.setOutputWatcher(new CircularOutputStream(logFile, bufferSize));
profile.setPort(delegate.getAddressOfRemoteServer().getPort());
profile.updateUserPrefs();
this.process.clean(profile);