@Lichtsignaal @Dave1829
Apparently my problem was with Kaspersky. I made the jar app trusty with all communication with the app to be trusted (from network and firewall setting). It is now working fine.
I shared the project here
Thanks to everyone.