With the previous value (10 seconds by default), a connection
established with HTTP long-polling was closed if the server did not
send any packet for 10 seconds (the HTTP request would timeout from the
client side).
It will now default to 1 minute, which is above the
`pingInterval + pingTimeout` value from the server.
Note: the connectTimeout and writeTimeout options are left as is (10
seconds), but you may need to increase them depending on your use case:
```
OkHttpClient client = new OkHttpClient.Builder()
.connectTimeout(20, TimeUnit.SECONDS)
.readTimeout(1, TimeUnit.MINUTES)
.writeTimeout(1, TimeUnit.MINUTES)
.build();
```
Related:
- https://github.com/socketio/socket.io-client-java/issues/491
- https://github.com/socketio/socket.io-client-java/issues/660
Before this fix, the client could mark the polling transport as open
even though the handshake packet was not received properly (for
example, after a parsing error).
See also: 1c8cba8818
Similar to the option of the JS client:
```java
opts = new Socket.Options();
opts.extraHeaders = singletonMap("authorization", singletonList("bearer abcd"));
socket = new Socket(opts);
```
Note: the refactor of the options (similar to [1]) will be done in a
future step.
[1] 5f47a50ee5
This fixes NullPointerException when response doesn't have content type. Exception stack trace:
```
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String okhttp3.MediaType.toString()' on a null object reference
at io.socket.engineio.client.transports.PollingXHR$Request.onLoad(PollingXHR.java:271)
at io.socket.engineio.client.transports.PollingXHR$Request.access$700(PollingXHR.java:148)
at io.socket.engineio.client.transports.PollingXHR$Request$1.onResponse(PollingXHR.java:232)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:141)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
```