Trying to understand the best way to return pass/fail details to a Java App for a JUnit test run within Docker

I am trying to see if Docker can solve our problem.

I have a Java Application, within that application I am running different external jars which contain JUnit tests. The issue is that the JUnit tests are specific to a particular URL with a port. I want to be able to run these in parallel but since I can not pass a variable into the JUnit test I need to come up with anther solution.

I want to use Docker so I can run the tests in parallel and map the ports from within the Java Application to Docker and the tests running inside docker can then be run in parallel.


Is it possible to run Docker instance from the Java Application and return results from the JUnit test ran within Docker?
How is it possible to send output from the Docker instance back to the Java Application?