Possibly unrelated but, I was researching an issue for someone where Java applications would not connect to URLs. It turned out to be a keystore issue.
Again, probably unrelated but, since you mentioned 18.04 didn’t work but 16.04 does, I just wanted to mention it in case it was related in any way.
Cheers