/// <summary> /// Starts the connection to the extension. /// </summary> public void Start() { using (ILock lockObject = new SocketLock(this.profile.Port - 1)) { lockObject.LockObject(this.process.TimeoutInMilliseconds); try { int portToUse = DetermineNextFreePort(this.host, this.profile.Port); this.profile.Port = portToUse; this.profile.WriteToDisk(); this.process.Clean(this.profile); this.process.StartProfile(this.profile, new string[] { "-foreground" }); this.SetAddress(portToUse); // TODO (JimEvans): Get a better url algorithm. this.executor = new HttpCommandExecutor(new Uri(string.Format(CultureInfo.InvariantCulture, "http://{0}:{1}/hub/", this.host, portToUse)), this.timeout); } finally { lockObject.UnlockObject(); } } this.ConnectToBrowser(this.process.TimeoutInMilliseconds); }
/// <summary> /// Starts the connection to the extension. /// </summary> public void Start() { using (ILock lockObject = new SocketLock(this.profile.Port - 1)) { lockObject.LockObject(this.process.Timeout); try { int portToUse = DetermineNextFreePort(this.host, this.profile.Port); this.profile.Port = portToUse; this.profile.WriteToDisk(); this.process.Clean(this.profile); this.process.StartProfile(this.profile, new string[] { "-foreground" }); this.SetAddress(portToUse); // TODO (JimEvans): Get a better url algorithm. this.executor = new HttpCommandExecutor(new Uri(string.Format(CultureInfo.InvariantCulture, "http://{0}:{1}/hub/", this.host, portToUse)), this.timeout); this.ConnectToBrowser(this.process.Timeout); } finally { lockObject.UnlockObject(); } } }