I'm not so sure you would need to close the inputstream and stop the connection. What's the actual problem you are seeing?

// Json