title: com.android.volley.NoConnectionError: javax.net.ssl.SSLException: Connection closed by peer on 4.4.4 device (works on 7.0.1)
body: <p>I have got a problem with getting data from web service to spinner using volley.My problem is the same thing worked in <strong>Android 7.0.1 (emulator)</strong> but not in <strong>Android 4.4 (real device)</strong> what can I do now.Please help me out.
  My code is this</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity implements Spinner.OnItemSelectedListener{
  
      //Declaring an Spinner
      private Spinner spinner;
  
      //An ArrayList for Spinner Items
      private ArrayList&lt;String&gt; students;
  
      //JSON Array
      private JSONArray result;
      private RequestQueue requestQueue;
  
      //TextViews to display details
      private TextView textViewName;
      private TextView textViewCourse;
      private TextView textViewSession;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          //Initializing the ArrayList
          students = new ArrayList&lt;String&gt;();
  
          //Initializing Spinner
          spinner = (Spinner) findViewById(R.id.spinner);
  
          //Adding an Item Selected Listener to our Spinner
          //As we have implemented the class Spinner.OnItemSelectedListener to this class iteself we are passing this to setOnItemSelectedListener
          spinner.setOnItemSelectedListener(this);
  
          //Initializing TextViews
  
  
          //This method will fetch the data from the URL
          getData();
      }
  
      private void getData(){
  
  
          //Creating a request queue
  
          JsonObjectRequest StringRequest = new JsonObjectRequest(Config.DATA_URL, null,
                  new Response.Listener&lt;JSONObject&gt;() {
                      @Override
                      public void onResponse(JSONObject response) {
                          if (response != null) {
                              JSONObject j = null;
                              try {
                                  //Parsing the fetched Json String to JSON Object
                                  j = response;
  
                                  //Storing the Array of JSON String to our JSON Array
                                  result = j.getJSONArray(Config.JSON_ARRAY);
  
                                  //Calling method getStudents to get the students from the JSON Array
                                  getStudents(result);
                              } catch (JSONException e) {
                                  e.printStackTrace();
                              }
                          }
                      }
                  },
                  new Response.ErrorListener() {
                      @Override
                      public void onErrorResponse(VolleyError error) {
                          System.out.println("Volly error is this &gt;&gt;" + error);
  
  
  
                      }
  
                  });
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.JELLY_BEAN
                  &amp;&amp; Build.VERSION.SDK_INT &lt;= Build.VERSION_CODES.KITKAT) {
              HttpStack stack = null;
              try {
                  stack = new HurlStack(null, new TLSSocketFactory());
              } catch (KeyManagementException e) {
                  e.printStackTrace();
                  Log.d("Your Wrapper Class", "Could not create new stack for TLS v1.2");
                  stack = new HurlStack();
              } catch (NoSuchAlgorithmException e) {
                  e.printStackTrace();
                  Log.d("Your Wrapper Class", "Could not create new stack for TLS v1.2");
                  stack = new HurlStack();
              }
              requestQueue = Volley.newRequestQueue(getApplicationContext(), stack);
          } else {
              requestQueue = Volley.newRequestQueue(getApplicationContext());
          }
  
         requestQueue = Volley.newRequestQueue(this);
          requestQueue.add(StringRequest);
      }
  
  
      private void getStudents(JSONArray j){
          //Traversing through all the items in the json array
          for(int i=0;i&lt;j.length();i++){
              try {
                  //Getting json object
                  JSONObject json = j.getJSONObject(i);
  
                  //Adding the name of the student to array list
                  students.add(json.getString(Config.TAG_USERNAME));
              } catch (JSONException e) {
                  e.printStackTrace();
              }
          }
  
          Log.e("student &gt;&gt;",students.toString());
          //Setting adapter to show the items in the spinner
          spinner.setAdapter(new ArrayAdapter&lt;String&gt;(this,  android.R.layout.simple_spinner_item, students));
      }
  
      //Method to get student name of a particular position
  
  
      //this method will execute when we pic an item from the spinner
      @Override
      public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) {
          //Setting the values to textviews for a selected item
  
      }
  
      //When no item is selected this method would execute
      @Override
      public void onNothingSelected(AdapterView&lt;?&gt; parent) {
  
      }
  
  }
  </code></pre>