Wanted to post my resolution to an intermittent issue we've been having for the past year to an onsite SQL Server instance, which would disconnect and time out at random times, with the only logs stating:
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.
It was infuriating, because nothing about the environment had changed to cause, or resolve, the issues.
The solution was to switch away from Microsoft's JDBC to a 3rd party option, https://jtds.sourceforge.net/
This has solved all my connection problems so far. Maybe it will help you too!