title: DefaultHttpClient, HttpPost, etc. deprecated. How to post now?
body: <p>Before Android API 22 i simply did the following:</p>
  
  <pre><code>/**
   * 
   * @param url
   * @param params
   * @return
   * @throws ClientProtocolException
   * @throws IOException
   */
  public InputStream getStreamFromConnection(String url, List&lt;NameValuePair&gt; params) throws ClientProtocolException, IOException {
      if(ConnectionDetector.isConnectedToInternet(this.context)) {
          DefaultHttpClient httpClient = new DefaultHttpClient();
          HttpPost httpPost = new HttpPost(url);
          httpPost.setEntity(new UrlEncodedFormEntity(params, "utf-8"));
  
          HttpResponse httpResponse = httpClient.execute(httpPost);
          HttpEntity httpEntity = httpResponse.getEntity();
  
          return httpEntity.getContent();
      } else {
          return null;
      }
  }
  </code></pre>
  
  <p>Nearly everything in the above code now is deprecated (<code>NameValuePair</code>, <code>DefaultHttpClient</code>, <code>HttpPost</code>, <code>UrlEncodedFormEntity</code>, <code>HttpResponse</code>, <code>HttpEntity</code>, <code>ClientProtocolException</code>) and i cant find a recommend way to do in API 22+. How should i do my post now?</p>