I come back on this “issue”, because I met it.
As you said, and indeed you are right, underscore should not be allowed in DNS records.
But still, your application has a problem: a lack of warning/error message when this error happens.
Because of this behaviour (no warning at all), your application just looks like it is “no responding”, and users – which are not aware of this information, like I did – will just quit your application and delete it when they meet this bad behaviour … like I did.
Therefore, I think you should handling the URISyntaxException and warn the user (simple message like “Warning/error: underscores are not allowed in hostname.”)
Thanks for support.
PS: respecting standards is good, handling exceptions is better.