You will need to parse the text response. Make sure to read StdErr as well.
However I don't recommend you to use this code as it will block the main thread. If there is a http server running on this address then you can use HttpUtils2 to check the connection.
As my app will connect to a TCP socket using a port number, I want to add something to the app (such as ping test) so if the user can't connect to the IP/port they can run some type of test and see if the device can talk to that IP or not.