How to programmatically connect to moby where in docker demon we can connect to 2375 port


I was struggeling to run the automated test written on docker java apis. I had set up rancher earlier without exposing port 2375, i was able to run the test, however it is started failing recently. I would like to understand is there any way that we can expose demon to connect to moby apis?

Thanks in advance,