title: OkHTTP Websocket: Unexpected end of steam on Connection
body: <p>I'm trying to connect to the Stack Exchange chat Websocket. The websocket is used to receive new events in the chat, such as new messages.</p>
  
  <p>Here's the code used to create the Websocket:</p>
  
  <pre><code>String wsUrl = getWsUrl();
  Request wsRequest = new Request.Builder()
          .url(wsUrl)
          .build();
  WebSocketCall wsCall = WebSocketCall.create(httpClient, wsRequest);
  wsCall.enqueue(new ChatWebSocketListener());
  </code></pre>
  
  <p>The websocket URL is in this form:</p>
  
  <pre><code>wss://chat.sockets.stackexchange.com/events/16/4b3a8a1f68704b8db35ce9f0915c7c45
  </code></pre>
  
  <p>The WebSocketListener receives a <code>onFailure</code> response only, with this exception:</p>
  
  <pre><code>E/IOException﹕ unexpected end of stream on Connection{chat.sockets.stackexchange.com:443, proxy=DIRECT@ hostAddress=192.111.0.32 cipherSuite=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 protocol=http/1.1} (recycle count=0)
      java.io.IOException: unexpected end of stream on Connection{chat.sockets.stackexchange.com:443, proxy=DIRECT@ hostAddress=192.111.0.32 cipherSuite=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 protocol=http/1.1} (recycle count=0)
              at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:211)
              at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80)
              at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:917)
              at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:757)
              at com.squareup.okhttp.Call.getResponse(Call.java:274)
              at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:230)
              at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:201)
              at com.squareup.okhttp.Call.access$100(Call.java:36)
              at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:164)
              at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
              at java.lang.Thread.run(Thread.java:831)
       Caused by: java.io.EOFException: \n not found: size=0 content=...
              at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:200)
              at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:191)
              at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80)
              at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:917)
              at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:757)
              at com.squareup.okhttp.Call.getResponse(Call.java:274)
              at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:230)
              at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:201)
              at com.squareup.okhttp.Call.access$100(Call.java:36)
              at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:164)
              at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
              at java.lang.Thread.run(Thread.java:831)
  </code></pre>
  
  <p>I'm not sure what I'm doing wrong here, or how to interperet this exception. What's wrong with this websocket, and how can I fix it?</p>