Unable to start WebDriverAgent : Could not proxy command to remote server. Original error: Error: connect ECONNREFUSED 127.0.0.1:8100

I have an simple automation script for iOS. But it gets launching WebDriverAgent on specified simulator after that producing the given below error

[debug] [XCUITest] Unable to start WebDriverAgent session: Could not proxy command to remote server. Original error: Error: connect ECONNREFUSED 127.0.0.1:8100

Note:
Its always using port for 8100 even i have generated port randomly and set the wdaLocalPort in the capability.

For your reference find the below code am using to launch the application on simulator.

setup.java

    int wdaDevicePort = 8000 + (int)(Math.random() * ((9000 - 8000) + 1));		            
    File app = new File(inputMap.get(CommonConstant.APK_FILE_OR_WEBDRIVER_PATH));
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "");
    capabilities.setCapability(MobileCapabilityType.VERSION, inputMap.get(CommonConstant.BUILD_VERSION));
    capabilities.setCapability(MobileCapabilityType.PLATFORM, inputMap.get(CommonConstant.PLATFORM_NAME));
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, inputMap.get(CommonConstant.DEVICE_NAME));
    capabilities.setCapability(MobileCapabilityType.NO_RESET, true);
    capabilities.setCapability(MobileCapabilityType.FULL_RESET, false);
    capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
    capabilities.setCapability(MobileCapabilityType.UDID, inputMap.get(CommonConstant.PHYSICAL_DEVICE_ID));
    capabilities.setCapability("wdaLocalPort", wdaDevicePort);
    capabilities.setCapability("useNewWDA", true);
    capabilities.setCapability("app", app.getAbsolutePath());
    		   		        
   driverUrl = inputMap.get(CommonConstant.DRIVER_URL);
   driverUrl = driverUrl.replace("Port", Integer.toString(appiumPort));
   driver = new IOSDriver(new URL(driverUrl), capabilities);

Randomly generating port in FBConfiguration.m in the WebDriverAgentRunner xcode project file.

+ (NSRange)bindingPortRange
{
    int lower = 7200;
    int upper = 8200;
    int Port = lower + arc4random() % (upper - lower);
    
  // 'WebDriverAgent --port 8080' can be passed via the arguments to the process
  if (self.bindingPortRangeFromArguments.location != NSNotFound) {
    return self.bindingPortRangeFromArguments;
  }

  // Existence of USE_PORT in the environment implies the port range is managed by the launching process.
  if (NSProcessInfo.processInfo.environment[@"USE_PORT"]) {
    return NSMakeRange([NSProcessInfo.processInfo.environment[@"USE_PORT"] integerValue] , 1);
  }

  return NSMakeRange(Port, DefaultPortRange);
}

Appium Log:-

[Appium] Creating new XCUITestDriver (v2.27.1) session
[Appium] Capabilities:
[Appium]   app: '/Users/thangaraj/Desktop/test.ipa'
[Appium]   noReset: true
[Appium]   automationName: 'XCUITest'
[Appium]   useNewWDA: true
[Appium]   browserName: ''
[Appium]   udid: 'B7E75AA9-029B-4372-9910-8DD252004D31'
[Appium]   platformName: 'iOS'
[Appium]   version: '10.2'
[Appium]   deviceName: 'iPhone 7'
[Appium]   fullReset: false
[Appium]   platform: 'IOS'
[Appium]   wdaLocalPort: 8739
[debug] [XCUITest] XCUITestDriver version: 2.27.1
[BaseDriver] The following capabilities were provided, but are not recognized by appium: version, platform.
[BaseDriver] Session created with session id: de33e720-342a-4229-97c7-a98d9ba2fd7c
[debug] [XCUITest] Xcode version set to '8.2.1' (tools v8.3.0.0.1.1490382677)
[debug] [XCUITest] iOS SDK Version set to '10.2'
[debug] [BaseDriver] Event 'xcodeDetailsRetrieved' logged at 1493096693782 (10:34:53 GMT+0530 (IST))
[iOSSim] Constructing iOS simulator for Xcode version 8.2.1 with udid 'B7E75AA9-029B-4372-9910-8DD252004D31'
[XCUITest] Determining device to run tests on: udid: 'B7E75AA9-029B-4372-9910-8DD252004D31', real device: false
[XCUITest] No platformVersion specified. Using device version: '10.2'
[BaseDriver] Using local app '/Users/thangaraj/Desktop/Test.ipa'
[debug] [BaseDriver] Copying local zip to tmp dir
[debug] [BaseDriver] Unzipping /var/folders/q4/4h_fx95j46n76_vv4f1g_km00000gp/T/2017325-19461-1sgjiao.vf4glgcik9/appium-app.zip
[debug] [BaseDriver] Testing zip archive: /var/folders/q4/4h_fx95j46n76_vv4f1g_km00000gp/T/2017325-19461-1sgjiao.vf4glgcik9/appium-app.zip
[BaseDriver] Unzipped local app to '/var/folders/q4/4h_fx95j46n76_vv4f1g_km00000gp/T/2017325-19461-1sgjiao.vf4glgcik9/Payload/Buckitdream_Test.app'
[debug] [BaseDriver] Event 'appConfigured' logged at 1493096696880 (10:34:56 GMT+0530 (IST))
[debug] [XCUITest] Checking whether app '/var/folders/q4/4h_fx95j46n76_vv4f1g_km00000gp/T/2017325-19461-1sgjiao.vf4glgcik9/Payload/Test.app' is actually present on file system
[debug] [XCUITest] App is present
[debug] [iOS] Getting bundle ID from app '/var/folders/q4/4h_fx95j46n76_vv4f1g_km00000gp/T/2017325-19461-1sgjiao.vf4glgcik9/Payload/Test.app': 'xxxxxx..xxxxx.xxxx'
[debug] [BaseDriver] Event 'resetStarted' logged at 1493096696926 (10:34:56 GMT+0530 (IST))
[debug] [XCUITest] Reset: noReset is on. Leaving simulator as is
[debug] [BaseDriver] Event 'resetComplete' logged at 1493096696929 (10:34:56 GMT+0530 (IST))
[debug] [iOSLog] Starting iOS 10.2 simulator log capture
[debug] [iOSLog] System log path: /Users/thangaraj/Library/Logs/CoreSimulator/B7E75AA9-029B-4372-9910-8DD252004D31/system.log
[debug] [BaseDriver] Event 'logCaptureStarted' logged at 1493096696952 (10:34:56 GMT+0530 (IST))
[XCUITest] Setting up simulator
[debug] [iOS] No reason to set locale
[debug] [iOS] No iOS / app preferences to set
[XCUITest] Simulator with udid 'B7E75AA9-029B-4372-9910-8DD252004D31' already booted
[debug] [BaseDriver] Event 'simStarted' logged at 1493096697177 (10:34:57 GMT+0530 (IST))
[debug] [XCUITest] App 'xxxxx.xxxxxx.xxxxx' is already installed. No need to reinstall.
[debug] [BaseDriver] Event 'appInstalled' logged at 1493096697180 (10:34:57 GMT+0530 (IST))
[debug] [BaseDriver] Event 'wdaStartAttempted' logged at 1493096697182 (10:34:57 GMT+0530 (IST))
[XCUITest] Using WDA path: '/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent'
[XCUITest] Using WDA agent: '/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj'
[debug] [XCUITest] Capability 'useNewWDA' set, so uninstalling WDA before proceeding
[debug] [XCUITest] Removing WDA application from device
[debug] [BaseDriver] Event 'wdaUninstalled' logged at 1493096697289 (10:34:57 GMT+0530 (IST))
[XCUITest] Launching WebDriverAgent on the device
[debug] [XCUITest] Carthage found: '/usr/local/bin/carthage'
[debug] [XCUITest] Killing hanging processes
[debug] [XCUITest] Beginning test with command 'xcodebuild build-for-testing test-without-building -project /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=B7E75AA9-029B-4372-9910-8DD252004D31 -configuration Debug IPHONEOS_DEPLOYMENT_TARGET=10.2' in directory '/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent'
[debug] [XCUITest] Output from xcodebuild will not be logged
[debug] [XCUITest] Waiting up to 60000ms for WebDriverAgent to start
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [XCUITest] Log file for xcodebuild test: /Users/thangaraj/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/2542656F-009B-417F-A8EA-84F977F6F28D/Session-WebDriverAgentRunner-2017-04-25_103459-D5oEtt.log
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET 
[debug] [XCUITest] Unable to connect to running WebDriverAgent: Could not proxy command to remote server. Original error: Error: connect ECONNREFUSED 127.0.0.1:8100
[XCUITest] Getting status of WebDriverAgent on device timed out. Continuing
[debug] [BaseDriver] Event 'wdaSessionAttempted' logged at 1493096759516 (10:35:59 GMT+0530 (IST))
[debug] [XCUITest] Sending createSession command to WDA
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [XCUITest] Failed to create WDA session. Retrying...

Note:-

I referred one tutorial from youtube, however they running the automation the appium log having the following line
iproxy get to farward the local port into device port via usb.
But in my appium log not contains that activity.

I dont know whether that was the issue? If it is the issue , Please provide step to solve. Thanks in Advance!!!