title: mock https request in java
body: <p>Let's say I'm writing an application and I need to be able to do something like this:</p>
  
  <pre><code>String url = "https://someurl/";
  GetMethod method = new GetMethod(URLEncoder.encode(url));
  String content = method.getResponseBodyAsString();
  </code></pre>
  
  <p>Is there a way to provide a mock server that would let me handle the https request? What I'm looking for is a way to write unit tests, but I need to be able to mock the part that actually goes out to <a href="https://someurl" rel="noreferrer">https://someurl</a> so I can get a known response back.</p>