/** * Read the bytes from the wrapped {@link ByteBuffer}. */ @Override public int read(byte[] b) throws IOException { return (read (b, 0, b.length)); }
/** * Read the bytes from the wrapped {@link ByteBuffer}. */ @Override public int read(byte[] b) throws IOException { return (read (b, 0, b.length)); }
/** * Read the bytes from the wrapped {@link ByteBuffer}. */ @Override public int read(byte[] b) throws IOException { return (read (b, 0, b.length)); }
public void testCaseOne(){ // pseudocode for the mock - this will vary depending on your mock framework InputReader reader = createMock(InputReader); // the first time you read it will be a "1", the next time it will be an "x" expect(reader.read()).andReturn("1"); expect(reader.read()).andReturn("x"); PrintStream stream = createMock(PrintStream); // only expect the "1" to get written. the "x" is the exit signal expect(stream.println("1")); new YourClass(reader,stream).run(); verifyMocks(); }
if (blocking){ inputStream.setSelectionKey(key); return inputStream.read(byteBuffer); } else { if (callbackHandler == null){
inputStream.setChannelType( InputReader.ChannelType.DatagramChannel); int nRead = inputStream.read(byteBuffer); return nRead; } else {