diff --git a/lib/webdriveragent.js b/lib/webdriveragent.js
index <HASH>..<HASH> 100644
--- a/lib/webdriveragent.js
+++ b/lib/webdriveragent.js
@@ -75,6 +75,7 @@ class WebDriverAgent {
       this.iproxy = this.createiProxySubProcess(localport, this.url.port);
       await this.startiproxy();
       this.url.hostname = `localhost`;
+      this.url.port = localport;
     }
 
     this.setupProxy(sessionId);
sending updated port to jwproxy