How to run a JUnit test for 2 different devices on Appium

I wanted to know how to run a JUnit test which can target 2 different devices?

I see you can setup Appium to target a device and set the port for that Appium server but how do you get JUnit to test the 2 different devices?

Setup for Appium on device (32456 and 43364):

node . -p 4492 -bp 2251 -U 32456

node . -p 4491 -bp 2252 -U 43364

This will run 2 Appium servers with different ports.

Inside my JUnit test I have the setup for the AndroidDriver with the port. How are you able to test 2 different devices with the same junit test?

driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), cap);