I am using SharePoint 2013 On-premise environment.
When I try to open an attachment of list item , it gives me an error "Connection refused".
It sounds like your Office Online Server is not property configured, or is having issues.
When you visit a library and click "new document", does it open a new Word document in browser? (I.e. in Office Online Server)
If you know the name of your Office Online Server, you can check the status using: