You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously failing with:
okio.SocketTimeoutTest#writeWithTimeout
junit.framework.AssertionFailedError
at junit.framework.Assert.fail(Assert.java:56)
at okio.SocketTimeoutTest.writeWithTimeout(SocketTimeoutTest.java:75)
The problem: the 1MB of data can be written to the
client socket even though the server socket is not reading.
This is because sockets on Android are buffered by default
by more that the amount of data in the test. This prevents
the write timeout occurring.
Socket defaults measured on a Nexus 4 running AOSP:
send: 524288 bytes, receive: 1048576 bytes.
IIRC, it varies by device.
Only some of the buffers need to be set to fix this, but
setting all of them seems reasonable to make it explicit.
The buffers are set to 1/4 of the data being
transferred to ensure that the data will
flood the send and receive buffers with some to spare.
Too small and the "withoutTimeout" tests will timeout
due to inefficiency.
The tests were also failing on a Linux desktop, probably
for similar reasons.
0 commit comments