title: Getting SSLException while payment gateway integration
body: <p>I am just integrating  Frimi payment gateway .In first step am trying to generate access tokes ,and after generating tokes payment link will be called .
  But am getting error :- SSLException: Connection closed by peer.</p>
  
  <pre><code> public  void TokenGenerationProcess() {
          class WaitingforResponse extends AsyncTask&lt;Void, Void, String&gt; {
              ProgressDialog progressDialog;
  
              @Override
              protected void onPreExecute() {
                  super.onPreExecute();
                  //  progressDialog = ProgressDialog.show(getActivity().getBaseContext(), "Waiting for Token Generation...", "Please Wait...", false, false);
              }
  
              @Override
              protected String doInBackground(Void... params) {
                  OkHttpClient client = new OkHttpClient.Builder()
                          .connectTimeout(10, TimeUnit.SECONDS)
                          .writeTimeout(10, TimeUnit.SECONDS)
                          .readTimeout(60, TimeUnit.SECONDS)
                          .build();
                  MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
  
                  String json = "";
                  RequestBody body = RequestBody.create(mediaType, json);
                 /* https://ideabiz?grant_type=password&amp;username=99R_User&amp;password=99R_User&amp;scope=SANDBOX
  
                  https://igrant_type=refresh_token&amp;refresh_token="+Message+"&amp;scope=SANDBOX */
                  // Message="d6a5be5f5455c87c21442ba3d5201c8c";
                  Request request = new Request.Builder()
                          .url("https://uatapi.nationstrust.com:8243/token?grant_type=client_credentials")
  
                          .addHeader("content-type", "application/x-www-form-urlencoded")
                          .addHeader("authorization", "Basic N000SDNmU3RtVERuZmZ1R0JNMlBGR1FXdmtFYTpEQUFJcEprVUhjdXBwcEx4dkRPSkFYZjNwMmth")
                          .post(body)
                          .build();
  //Bearer aUFVMWFRd2Vpb2txQUI2VTFkajBFZWRkTTBZYTpEMzZfbU9GM2ZlYkFEaWRiMGp0ZUZCN2xGUUlh")
  
  
                  try {
                      okhttp3.Response response = client.newCall(request).execute();
                      String test = response.body().string();
                      if (response.isSuccessful()) {
                         /* int  success = response.code();
  
                          Headers responseHeaders = response.headers();
                          for (int i = 0; i &lt; responseHeaders.size(); i++) {
  
                              System.out.println(responseHeaders.name(i) + ": " + responseHeaders.value(i));
                          }
  
                          System.out.println(test);
                          ///   {"scope":"default","token_type":"bearer","expires_in":3600,"refresh_token":"2d23c431f25e10e5abcd16bea931d0a","access_token":"b0bffddb2be384c53135cadf0f565c2"}
                          try {
                              JSONObject jsonObject = new JSONObject(test);
                              Log.e(" scope", "" + jsonObject.get("scope"));
                              Log.e(" token_type", "" + jsonObject.get("token_type"));
                              Log.e(" expires_in", "" + jsonObject.get("expires_in"));
                              Log.e(" refresh_token", "" + jsonObject.get("refresh_token"));
                              Log.e(" access_token", "" + jsonObject.get("access_token"));
                              // Message = (String) jsonObject.get("refresh_token");
  
                              String  access_token = (String) jsonObject.get("access_token");
                              String  refresh_token = (String) jsonObject.get("refresh_token");
                              PersistenceManager.saveRefreshToken(getApplicationContext(), refresh_token);
                              PersistenceManager.saveSessionId(getApplicationContext(), access_token);
                              PersistenceManager.saveTime(getApplicationContext(), String.valueOf(System.currentTimeMillis()));
       */                       // reference= (String) jsonObject.get("Refno");
  
                      } else {
                          System.out.println(test);
                      }
  
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
                  return null;
              }
  
              @Override
              protected void onPostExecute(String s) {
                  super.onPostExecute(s);
                  // progressDialog.dismiss();
              }
  
  
          }
          WaitingforResponse WaitingforResponse = new WaitingforResponse();
          WaitingforResponse.execute();
  
      }
  </code></pre>
  
  <p><strong>See Stacktrace below:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/7CzG0.png" alt="enter image description here"></p>
  
  <p>// here I have posted full code what I am trying to generate access tokes.
  /please help..help would be greatly appreciated</p>