How to unit test an helper function that use HTTPConnection
<p>I have written a <strong>helper function</strong> that can retrieve content from a url. This function can also parse a <code>Map</code> of parameters and feed a url or a body on request depending on <code>GET</code> or <code>POST</code> method. Let's say this function also do other things (change headers, cookies etc...). How can I test this function against an http(s) server ? How to simulate a fake servlet that will answer to the request made by this function ?
I've seen that we can use mock object, or other library that are specialized in servlet unit testing. But it doesn't seem to fit my needs as I trully need to test the request and its answer without changing the function content.</p>
