title: Retrofit takes too much time to get response
body: <p>I'm using retrofit for REST API call. When checking using <strong>POSTMAN client</strong> the <strong>response i can get it in fraction of seconds</strong>. I takes less than a second to get response. While i <strong>called the request using the retrofit</strong> it <strong>takes more than 5 to 10 seconds to get the response</strong>. It shows my app working slower. Kindly suggest me a solution. </p>
  
  <p>Note: Web API created in .NET</p>
  
  <p>Below is my code</p>
  
  <pre><code>//Retrofit client code:
  
  HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
      interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
      OkHttpClient client = new 
              OkHttpClient.Builder().addInterceptor(interceptor)
                                  .connectTimeout(600, TimeUnit.SECONDS)
                                  .readTimeout(600, TimeUnit.SECONDS)
                                  .build();
  
  
      if (client != null) {
          ConnectionPool pool = client.connectionPool();
          if (pool != null) {
  
              pool.evictAll();
          }
      }
  
      if (retrofit==null) {
          retrofit = new Retrofit.Builder()
                  .baseUrl(baseUrl)
                  .addConverterFactory(GsonConverterFactory.create())
                  .client(client)
                  .build();
      }
  </code></pre>
  
  <p>And my request call is below:</p>
  
  <pre><code> private void makeServiceCallUPSData(String upsNameId, String spvId) {
      showLoadingView();
  
      if (calledFrom.equals(Constants.UPS_EDIT)) {
          logId = upsId;
      } else {
          logId = "0";
      }
  
      apiService.getUPSData(upsNameId, spvId, logId, authorizationToken).enqueue(new Callback&lt;UPSDataResponse&gt;() {
          @Override
          public void onResponse(Call&lt;UPSDataResponse&gt; call, Response&lt;UPSDataResponse&gt; response) {
  
              if (response.isSuccessful()) {
                  UPSDataResponse upsDataResponse = response.body();
                  hideLoadingView();
                  if (upsDataResponse.getCode() == Constants.RESPONSE_SUCCESS) {
                      updateUI(upsDataResponse);
                  } else {
                      showErrorAlertDialog(upsDataResponse.getMessage());
                  }
                  Logger.infoLog("Logg resp " + response.body());
              }
          }
  
          @Override
          public void onFailure(Call&lt;UPSDataResponse&gt; call, Throwable t) {
              //dismissProgressDialog();
              hideLoadingView();
              //Toast.makeText(thisActivity, "Server not Responsding. Try after Sometime", Toast.LENGTH_SHORT).show();
          }
      });
  }
  </code></pre>
  
  <p>Also added the below the log:</p>
  
  <pre><code> 07-19 16:57:07.920 32345-2045/com.vcarel.test D/OkHttp: --&gt; GET http://14.143.142.43/api/HMS/HMSUPS/GetUPSData?upsNameId=2370&amp;spvId=6&amp;logId=0
   07-19 16:57:07.920 32345-2045/com.vcarel.test D/OkHttp: Cache-Control: max-age=640000
   07-19 16:57:07.920 32345-2045/com.vcarel.test D/OkHttp: Authorization: bearer 6ndJHgICCPj6zaMpW6SzEZN06zcDHE5PaEHVJ9jol--Md5Hla_J-Nx9-wynQ_nG8OBjNn5LjA5
   07-19 16:57:07.920 32345-2045/com.vcarel.test D/OkHttp: --&gt; END GET
   07-19 16:57:12.670 32345-2045/com.vcarel.test D/OkHttp: &lt;-- 200 OK http://14.143.142.43/api/HMS/HMSUPS/GetUPSData?upsNameId=2370&amp;spvId=6&amp;logId=0 (4747ms)
   07-19 16:57:12.670 32345-2045/com.vcarel.test D/OkHttp: Cache-Control: no-cache
   07-19 16:57:12.670 32345-2045/com.vcarel.test D/OkHttp: Pragma: no-cache
   07-19 16:57:12.670 32345-2045/com.vcarel.test D/OkHttp: Content-Type: application/json; charset=utf-8
   07-19 16:57:12.670 32345-2045/com.vcarel.test D/OkHttp: Expires: -1
   07-19 16:57:12.670 32345-2045/com.vcarel.test D/OkHttp: Server: Microsoft-IIS/8.5
   07-19 16:57:12.670 32345-2045/com.vcarel.test D/OkHttp: X-AspNet-Version: 4.0.30319
   07-19 16:57:12.670 32345-2045/com.vcarel.test D/OkHttp: X-Powered-By: ASP.NET
   07-19 16:57:12.670 32345-2045/com.vcarel.test D/OkHttp: Date: Thu, 19 Jul 2018 11:27:23 GMT
   07-19 16:57:12.670 32345-2045/com.vcarel.test D/OkHttp: Content-Length: 513
   07-19 16:57:12.670 32345-2045/com.vcarel.test D/OkHttp: {"Code":200,"Message":"Success","Respone":{"MainCurrentB":"1.000","MainCurrentR":"1.000","MainCurrentY":"1.000","MainVoltageB":"1.000","MainVoltageR":"1.000","MainVoltageY":"1.000","MainRectifierVoltage":"2.500","BypassVoltage":"1.000","BypassCurrent":"2.500","BypassFr48to52Hz":"0.000","OutputVoltage":"2.225","OutputCurrent":"2.500","OutputFr48to52Hz":"0.000","OutputTem":"2.500","BatteryVdc":"25.000","BatteryLb":"0.000","DateTime":"2018-07-19 16:42:00","Remarks":"test","fromVDC":"300.000","toVDC":"350.000"}}
   07-19 16:57:12.670 32345-2045/com.vcarel.test D/OkHttp: &lt;-- END HTTP (513-byte body)
  </code></pre>
  
  <p>In the above log see the time difference between <strong>End GET</strong> and <strong>200 OK</strong> Likewise i'm getting delay it resembles app being working slower.</p>