You're printing "Failed connection" in a finally block. That means it's always going to be printed - the finally block will always run (that's what it's for).
I suspect what you really wanted to do was print that out if there's an exception, in which case it needs to be in a catch block.
Thank you my well lotioned goddess! Here, have my favorite tiny ad!
a bit of art, as a gift, that will fit in a stocking