@Test public void testIOException() { InputStream in = new InputStream() { @Override public int read() throws IOException { throw new IOException(); } }; Reader r = new Reader(in, 1024); try { r.nextReply(null, false); Assert.fail("expect io exception"); } catch (ProtocolIOException e) { } }
private Reply readReply(String s) { ByteArrayInputStream in = new ByteArrayInputStream(s.getBytes()); Reader r = new Reader(in, 1024); return r.nextReply(null, false); }