private byte readChunk ( ) throws IOException { try { return readChunkImpl ( ) ; } catch ( SocketException ex ) { // Some stream implementations may throw SocketException and not EOFException when socket is // terminated by // application // By common agreement, rethrow it as EOFException and let an upstream handler take care. synchronized ( orchestratorEvent ) { if ( shutdown ) { EOFException newException = new EOFException ( "NGCommunicator is shutting down" ) ; newException . initCause ( ex ) ; throw newException ; } } throw ex ; } }
Reads a NailGun chunk header from the underlying InputStream .