title: HttpStatus become deprecated in API level 22
body: <p>Usually I used to check for the server different code responses in my <code>RestClient</code> class using the <code>org.apache.http.HttpStatus</code> class as the following example:</p>
  
  <pre><code>if (HttpStatus.SC_OK == restClient.getResponseCode()) {
              //200 OK (HTTP/1.0 - RFC 1945)
              return true;
  } else if (HttpStatus.SC_BAD_GATEWAY == restClient.getResponseCode()){
             //502 Bad Gateway (HTTP/1.0 - RFC 1945)
              return false;
  }
  </code></pre>
  
  <p>But recently the class became <strong>deprecated since API level 22</strong> according to the official <a href="http://developer.android.com/reference/org/apache/http/HttpStatus.html">documentation</a> </p>
  
  <blockquote>
    <p>This interface was deprecated in API level
    22. Please use <a href="http://developer.android.com/reference/java/net/URL.html#openConnection()">openConnection()</a> instead. Please visit this <a href="http://android-developers.blogspot.ae/2011/09/androids-http-clients.html">webpage</a> for further details.</p>
  </blockquote>
  
  <p>But using <code>OpenConnection()</code> method for me does not make any sense. </p>
  
  <p><strong>My Question is:</strong> Is there any other way to do the same functionality without needing to hardcode all the code responses by myself within the application? </p>
  
  <p>Thanks in advance.</p>