Previously, when an invalid port was specified in -rpcbind, the SplitHostPort() return value in HTTPBindAddresses() was ignored and attempt would be made to bind to the default rpcbind port (with the host/port treated as a host).
This rearranges port checking code in AppInitMain() to handle the invalid port before reaching HTTPBindAddresses(). Also adds a check in HTTPBindAddresses() as a defensive measure for future changes.
Adds then updates associated functional tests as well.