Concerned about thread-safety here. 

Case 1: We synchronize on flush, but two threads could simultaneously be inside maybeAppend between lines 69-73 simultaneously (i.e, after each has checked that there is enough room for the checking thread, but not checking that there is enough room for both the checking thread and any other threads)

Case 2: if two threads reach the truthy case of `if (buf.remaining() < (data.length + 1))` simultaneously. One would get the lock, the other would block until the first flush completes, then immediately force a re-flush with a partial buffer (sure, it probably fails with `if (sz <= 0)`, but if let's say, 20 threads were blocked here, one of those is probably going to encounter a non-zero-sized buffer when it finally gets a lock on flush).

Case 3: thread 1 executes line 71 (`buf.put(EOL);`) then thread 2 executes that line, then thread 1 executes `buf.put(data)`.