InputStream .available only checks if data is available to read right
now. It is possible that data becomes available leter. Read method (used
by Transit internally) will block untill data is available or the stream
is closed.
It is best to let Transit read the stream. Empty streams throws an
exception with Transit, but we can catch that specific case and return
nil like previously.
Two test cases test the existing functionality, and third new test case
checks that Transit data is read correctly when the data becomes
available a bit later.
… right-away
InputStream .available only checks if data is available to read right now. It is possible that data becomes available leter. Read method (used by Transit internally) will block untill data is available or the stream is closed.
It is best to let Transit read the stream. Empty streams throws an exception with Transit, but we can catch that specific case and return nil like previously.
Two test cases test the existing functionality, and third new test case checks that Transit data is read correctly when the data becomes available a bit later.