title: volley synchronous request blocks forever
body: <p>I want to make synchronous request using volley library and I used the following code : </p>
  
  <pre><code>RequestFuture&lt;Long&gt; future = RequestFuture.newFuture();
  
          AuthenticatedJsonRequest request = new AuthenticatedJsonRequest(Method.GET,ServiceUrl,null,future,future);
          requestQueue.add(request);
  
          try {
  
              Long response = future.get();
  </code></pre>
  
  <p>but the code is blocking forever here : </p>
  
  <pre><code>Long response = future.get();
  </code></pre>
  
  <p>and this is my custom JsonRequest</p>
  
  <pre><code>public class AuthenticatedJsonRequest extends JsonRequest&lt;Long&gt; {
  
  
  
      public AuthenticatedJsonRequest(int method, String url, String requestBody, Listener&lt;Long&gt; listener,
              ErrorListener errorListener) {
          super(method, url, requestBody, listener, errorListener);
          // TODO Auto-generated constructor stub
      }
  
      @Override
      public Map&lt;String, String&gt; getHeaders() throws AuthFailureError {
          Map&lt;String, String&gt; headers = new HashMap&lt;String, String&gt;();
          String creds = String.format("%s:%s", RestClient.UserName, RestClient.Password);
          String auth = "Basic " + Base64.encodeToString(creds.getBytes(), Base64.DEFAULT);
          headers.put("Authorization", auth);
          return headers;
      }
  
  
  
      @Override
      protected Response&lt;Long&gt; parseNetworkResponse(NetworkResponse response) {
            try {
  
                 String jsonString =
                      new String(response.data, HttpHeaderParser.parseCharset(response.headers));
                  return Response.success(Long.valueOf(jsonString),
                          HttpHeaderParser.parseCacheHeaders(response));
              } catch (UnsupportedEncodingException e) {
                  return Response.error(new ParseError(e));
              }
      }
  </code></pre>
  
  <p>I debugged volley code and it is stopping in NetworkDispatcher</p>
  
  <p>// Take a request from the queue.</p>
  
  <pre><code>   request = mQueue.take();
  </code></pre>