title: SSL Exception when using Volley
body: <p>I'm using Volley in Android to perform my app requests. Unfortunately, I'm getting the following error:</p>
  
  <pre><code>com.android.volley.NoConnectionError: javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x61e15f78: Failure in SSL library, usually a protocol error
      error:1407743E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert inappropriate fallback (external/openssl/ssl/s23_clnt.c:744 0x5b647c58:0x00000000)
  </code></pre>
  
  <p>I'm using two <code>Fragments</code>, inside a <code>ViewPager</code>, which request their content during onResume. The requests url is basically the same but for a query parameter (which set the type of content, e.g. trending vs hot).</p>
  
  <p>The url is in the form <code>https://host/api/content?type={hot/trending}</code>. Authorization is done through the request header.</p>
  
  <p>The weird part about this exception is that only one of the two requests fail and it varies which one from time to time. After I added a delay between them, the exception stopped occurring (oddly pointing to some race condition?). But this seems a bad workaround and I'd like to solve this the right way.</p>
  
  <p>Any thoughts on what could be the cause of it?</p>
  
  <p>EDIT:</p>
  
  <p>The request is created the standard way, using a singleton providing the queue, as follows:</p>
  
  <pre><code>final RequestQueue requestQueue = RequestQueueSingleton.getInstance(getActivity()).getRequestQueue();
  final GsonRequestGet&lt;SearchApiWrapper&gt; gsonRequest = new GsonRequestGet&lt;&gt;(clazz, url,successListener, errorListener);
  gsonRequest.setRetryPolicy(new DefaultRetryPolicy(3000, 3, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
  gsonRequest.setTag(mTag);
  requestQueue.add(gsonRequest);
  </code></pre>
  
  <p>And here is the singleton class:</p>
  
  <pre><code>public class RequestQueueSingleton {
  
      private static RequestQueueSingleton mInstance;
      private RequestQueue mRequestQueue;
      private Context mContext;
  
      public RequestQueueSingleton(Context context) {
          mContext = context;
          mRequestQueue = getRequestQueue();
      }
  
      /**
       * Returns a instance of this singleton
       */
      public static synchronized RequestQueueSingleton getInstance(Context context) {
          if (mInstance == null) {
              mInstance = new RequestQueueSingleton(context);
          }
          return mInstance;
      }
  
      /**
       * Returns instance of the request queue
       */
      public RequestQueue getRequestQueue() {
          if (mRequestQueue == null) {
              mRequestQueue = Volley.newRequestQueue(mContext.getApplicationContext());
          }
          return mRequestQueue;
      }
  }
  </code></pre>