@Test(expected = FormatException.class) public void testThrowsExceptionIfProtocolVersionIsUnrecognised() throws Exception { byte version = (byte) (PROTOCOL_VERSION + 1); byte[] payload = getRandomId(); expectReadRecord(new Record(version, ACK, payload)); SyncRecordReader reader = new SyncRecordReaderImpl(messageFactory, recordReader); reader.eof(); }
@Override public boolean eof() throws IOException { if (nextRecord != null) return false; if (eof) return true; try { readRecord(); return false; } catch (EOFException e) { nextRecord = null; eof = true; return true; } }
SyncRecordReaderImpl implements SyncRecordReader { @Override public boolean eof() throws IOException { if (nextRecord != null) return false; if (eof) return true; try { readRecord(); return false; } catch (EOFException e) { nextRecord = null; eof = true; return true; } } }
SyncRecordReaderImpl implements SyncRecordReader { @Override public boolean eof() throws IOException { if (nextRecord != null) return false; if (eof) return true; try { readRecord(); return false; } catch (EOFException e) { nextRecord = null; eof = true; return true; } } SyncRecordReaderImpl(MessageFactory messageFactory, RecordReader reader); }
SyncRecordReaderImpl implements SyncRecordReader { @Override public boolean eof() throws IOException { if (nextRecord != null) return false; if (eof) return true; try { readRecord(); return false; } catch (EOFException e) { nextRecord = null; eof = true; return true; } } SyncRecordReaderImpl(MessageFactory messageFactory, RecordReader reader); @Override boolean eof(); @Override boolean hasAck(); @Override Ack readAck(); @Override boolean hasMessage(); @Override Message readMessage(); @Override boolean hasOffer(); @Override Offer readOffer(); @Override boolean hasRequest(); @Override Request readRequest(); }
SyncRecordReaderImpl implements SyncRecordReader { @Override public boolean eof() throws IOException { if (nextRecord != null) return false; if (eof) return true; try { readRecord(); return false; } catch (EOFException e) { nextRecord = null; eof = true; return true; } } SyncRecordReaderImpl(MessageFactory messageFactory, RecordReader reader); @Override boolean eof(); @Override boolean hasAck(); @Override Ack readAck(); @Override boolean hasMessage(); @Override Message readMessage(); @Override boolean hasOffer(); @Override Offer readOffer(); @Override boolean hasRequest(); @Override Request readRequest();  }