Run junit test inside docker

I have an integration test that needs docker container and junit communicate each other without network mapping. Port mapping is not an option for me because of the udp protocol I deal with. Host network doesn’t not work with docker for Mac. Please help me find a solution. Ideally I need to integrate with my gradle build script.

Source: StackOverflow