title: OkHttp EventListener : byteCount value is always zero in responseBodyEnd callback
body: <p>I am using <a href="https://square.github.io/okhttp/events/" rel="nofollow noreferrer">EventListener</a> callback for some analysis in my app but I am facing an issue where I am not getting the correct value <code>byteCount</code> in <code>responseBodyEnd</code> callback. It is always 0.</p>
  
  <p>I am attaching the code below.</p>
  
  <pre><code>val client = OkHttpClient.Builder()
               .eventListenerFactory(HttpEventListenerFactory.FACTORY)
               .build()
  
  val request = Request.Builder()
                .url("http://jsonplaceholder.typicode.com/comments?postId=1")
                .build()
  
   with(client) {
       newCall(request).enqueue(object : Callback {
          override fun onFailure(call: Call, e: IOException) {
              Log.d("OkHttp##", "Request failed")
          }
  
          override fun onResponse(call: Call, response: Response) {
              handleResponse(response.body())
              response.close()
              Log.d("OkHttp##", "Response received")
          }
       })
   }
  </code></pre>
  
  <p><strong>MyEventListenerImpl.kt</strong></p>
  
  <pre><code>public class HttpEventListenerFactory extends EventListener {
      public static final Factory FACTORY = new Factory() {
  
      final AtomicLong nextCallId = new AtomicLong(1L);
  
      @Override
      public EventListener create(Call call) {
              long callId = nextCallId.getAndIncrement();
              Log.d("OkHttp##", "next call id : " + nextCallId);
              String message = String.format(Locale.US, "%04d %s%n", callId, call.request().url());
              Log.d("OkHttp##", message);
              return new HttpEventListenerFactory(callId, System.nanoTime());
          }
      };
  
  @Override
  public void responseBodyEnd(Call call, long byteCount) {
      // this method never gets called
      // byteCount here is always 0
      printEvent("Response body end", callId);
  }
  </code></pre>