private static int getHttpStatusCode(String urlstring, String userName) throws IOException {
    URL url = new URL(urlstring + "?user.name=" + userName);
    System.out.println("Accessing " + url + " as user " + userName);
    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
    connection.connect();
    return connection.getResponseCode();
  }
Access a URL and get the corresponding return Http status code. The URL will be accessed as the
passed user, by sending user.name request parameter.
@param urlstring The url to access
@param userName  The user to perform access as
@return The HTTP response code
@throws IOException if there is a problem communicating with the server
hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestHttpServer.java