title: Customize Request class from Volley framework
body: <p>I'm trying to use a custom version of Request class from android Volley framework. I managed to work GET custom request but it fails with POST. I'm ovverriding getBody() method and returning byte[]. But Volley complains that connections are already open.</p>
  
  <p>Code:</p>
  
  <pre><code>@Override
  public byte[] getBody() throws AuthFailureError {
      JSONObject json = new JSONObject();
      try {
          json.put("date_in_millis", this.newsDateInMillis);
          json.put("title", URLEncoder.encode(this.newsTitle.replace("\n", "").replace("\r", ""), "UTF-8"));
          return new StringEntity("data=" + json.toString(), "UTF-8").toString().getBytes();
      } catch (Exception e) {
          throw new RuntimeException(e.getMessage());
      }
  }
  </code></pre>
  
  <p>Exception:</p>
  
  <pre><code>05-24 21:51:08.076: E/Volley(5535): [177] NetworkDispatcher.run: Unhandled exception     
  java.lang.IllegalStateException: Already connected
  05-24 21:51:08.076: E/Volley(5535): java.lang.IllegalStateException: Already connected
  05-24 21:51:08.076: E/Volley(5535):     at java.net.URLConnection.checkNotConnected(URLConnection.java:464)
  05-24 21:51:08.076: E/Volley(5535):     at java.net.URLConnection.setDoOutput(URLConnection.java:878)
  05-24 21:51:08.076: E/Volley(5535):     at com.android.volley.toolbox.HurlStack.addBodyIfExists(HurlStack.java:225)
  05-24 21:51:08.076: E/Volley(5535):     at com.android.volley.toolbox.HurlStack.setConnectionParametersForRequest(HurlStack.java:210)
  05-24 21:51:08.076: E/Volley(5535):     at com.android.volley.toolbox.HurlStack.performRequest(HurlStack.java:106)
  05-24 21:51:08.076: E/Volley(5535):     at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:93)
  05-24 21:51:08.076: E/Volley(5535):     at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:105)
  </code></pre>
  
  <p>Any one used Volley Request this way?</p>
  
  <p>Thanks</p>