/**
  * Performs a request
  *
  * @param url the URL to query
  * @param additionalHeaders additional HTTP request headers (may be null)
  * @return the parsed response
  * @throws IOException if the request was not successful
  */
 protected Map<String, Object> performRequest(String url, Map<String, String> additionalHeaders)
     throws IOException {
   if (accessToken == null) {
     throw new UnauthorizedException("Access token has not yet been requested");
   }
   URL u = new URL(url);
   Response response = auth.request(u, Method.GET, accessToken, additionalHeaders);
   InputStream is = response.getInputStream();
   try {
     return parseResponse(response);
   } finally {
     is.close();
   }
 }
 @Override
 public void authorize(String verificationCode) throws IOException {
   try {
     accessToken =
         auth.requestTokenCredentials(
             new URL(getOAuthAccessTokenURL()),
             getOAuthAccessTokenMethod(),
             requestToken,
             verificationCode);
   } catch (MalformedURLException e) {
     // should never happen
     throw new RuntimeException(e);
   }
 }
  @Override
  public String getAuthorizationURL() throws IOException {
    String rtu = getOAuthRequestTokenURL();
    if (rtu == null) {
      return getOAuthAuthorizationURL();
    }

    try {
      requestToken = auth.requestTemporaryCredentials(new URL(rtu), Method.GET);
    } catch (MalformedURLException e) {
      // should never happen
      throw new RuntimeException(e);
    }
    return getOAuthAuthorizationURL() + requestToken.getToken();
  }