title: HttpUrlConnection ignores the entered values
body: <p>I'm trying to make a <strong>HttpUrlConnection POST</strong> to the PayPal sandbox token to get an access token, but when I run my app it ignores the entered values (method, <code>doOutput</code>...).
  I tried <strong><code>HttpsUrlConnection</code></strong> too.
  <strong><em>Where is the problem?</em></strong></p>
  
  <p>This method is called from the <strong><code>AsyncTask</code></strong> class, inside the <strong><code>doInBackground()</code></strong> method.</p>
  
  <pre><code>private String makeHttpAuth(URL authURL) throws IOException, JSONException {
  // authUrl = "https://api.sandbox.paypal.com/v1/oauth2/token"
  // BASICINPUT = "Basic " + Base64.encodeToString(AUTHINPUT.getBytes(), Base64.NO_WRAP);
  
  String authJsonResponse = "";
  String grant = authBody().toString();
  
      if (authURL == null) {
          return authJsonResponse;
      }
      HttpURLConnection authentication = null;
      InputStream inputStream = null;
  
      try {
  
          authentication = (HttpURLConnection) authURL.openConnection();
          authentication.setRequestMethod("POST");
          authentication.setConnectTimeout(15000);
          authentication.setRequestProperty(AUTHORIZE, BASICINPUT);
          authentication.setDoInput(true);
          authentication.setDoOutput(true);
  
          OutputStreamWriter writer = new OutputStreamWriter(authentication.getOutputStream());
  
          writer.write(grant);
          writer.flush();
          writer.close();
          authentication.connect();
  
          if (authentication.getResponseCode() == 200) {
              inputStream = authentication.getInputStream();
              authJsonResponse = readFromStream(inputStream);
          } else {
              Log.e(LOG_TAG, "Error response code: " + authentication.getResponseCode());
          }
  
      } finally {
          if (authentication != null) {
              authentication.disconnect();
          }
          if (inputStream != null) {
              inputStream.close();
          }
      }
      return authJsonResponse;
  </code></pre>
  
  <p><strong>Expected:</strong></p>
  
  <p>...</p>
  
  <ul>
  <li>method: "<strong>POST</strong>"</li>
  <li>doOutput: <strong>true</strong></li>
  <li>responseCode: <strong>200</strong></li>
  </ul>
  
  <p>...</p>
  
  <p><strong>Actual:</strong></p>
  
  <p>...</p>
  
  <ul>
  <li>method: "<strong>GET</strong>"</li>
  <li>doOutput: <strong>false</strong></li>
  <li>responseCode: <strong>-1</strong></li>
  </ul>
  
  <p>...</p>