Protect MIDI framework against client blocks in MidiReceiver.onSend

Make the server-side socket non-blocking when creating MidiOutputPort
for clients. Thus if a client ceases to read from its side of the
socket pair, the server will just fail to write instead of blocking.

One drawback is that the MidiOutputPort on the client can't indicate
that it has become dysfunctional, but it's not possible without
changing the API.

Bug: 29413812
Change-Id: I9dfcbdd214a815cea8fd1365324fd78ca459268a
3 files changed