Thread messageProcessingThread = new Thread(new Runnable() {
@Override
public void run() {
try {
while (true) {
Message message = Message.parseDelimitedFrom(inputStream);
if (message == null) {
// EOF detected. Throw an IOException to emulate old behaviour.
// TODO(rluble): hacky, maybe the server should terminate normally in this case.
throw new IOException("Attempt to read past EOF");
}