Ajay's creativity aside, what you probably want to do is to store the object representing a connection (a URLConnection? A Socket?) in a member variable, such that the member variable is available whenever you need the connection object. Say the member is called "connection". Then your code might look like
When you close the connection,
you should also set this member variable to null, so it can be reopened properly.
To be truly correct, you'd want to do this in a synchronized block or method, to prevent multiple connections from being created by accident.
Does this make sense?