Devices are not run in parallel

I am new to appium. I am working on chat application.I did automation by connecting single android device.Due to chat application, i am in the situation of running multiple devices in parallel. So i am using selenium grid with appium now.
I try to run 2 devices parrallely. But only one device is running at a time.
My device1 configuration:
“configuration”:
{
“cleanUpCycle”:2000,
“timeout”:30000,
“proxy”: “org.openqa.grid.selenium.proxy.DefaultRemoteProxy”,
“url”:“http://127.0.0.1:5000/wd/hub”,
“host”: “127.0.0.1”,
“port”: 5000,
“maxSession”: 1,
“register”: true,
“registerCycle”: 5000,
“hubPort”: “4444”,
“hubHost”: “127.0.0.1”
}
configuration of device2:
“configuration”:
{
“cleanUpCycle”:2000,
“timeout”:30000,
“proxy”: “org.openqa.grid.selenium.proxy.DefaultRemoteProxy”,
“url”:“http://127.0.0.1:5000/wd/hub”,
“host”: “127.0.0.1”,
“port”: 5000,
“maxSession”: 1,
“register”: true,
“registerCycle”: 5000,
“hubPort”: “4444”,
“hubHost”: “127.0.0.1”
}
hub address is:
driver = new RemoteWebDriver(new URL(“http://127.0.0.1:5000/wd/hub”), caps);
I tried lot of solutions.but devices are not run parallel. plz help me.

I dont have any experience with selenium grid but I do know for sure that, for parallel testing devices, you need separate Appium servers running on separate ports. Otherwise there is no way for selenium to distinguish which device is where…

driver1 = new RemoteWebDriver(new URL(“http://127.0.0.1:5000/wd/hub”), caps);
driver2 = new RemoteWebDriver(new URL(“http://127.0.0.1:5001/wd/hub”), caps);

I cant say how Selenium Grid would handle two drivers like that; I ended up writing my own multi-threaded executable that wraps regular Selenium scripts to pull off parallel testing.

Take a look at my response to another similar question about Selenium Grid