Code written for establishing http connection with server.