@Test
 public void testReadOneLine() throws IOException {
   input.addChunk("ma che bel castello marcondirondirondello!\r\n".getBytes());
   input.precacheDataFromRemote();
   assertEquals("ma che bel castello marcondirondirondello!\r\n", input.readTextLine());
   assertTrue(input.noDataAvailable());
 }
 @Test
 public void testReadOneLineAndGarbage() throws IOException {
   input.addChunk("ma che bel castello marcondirondirondello!\r\nMiaoMiaoMiaoooooo".getBytes());
   input.precacheDataFromRemote();
   assertEquals("ma che bel castello marcondirondirondello!\r\n", input.readTextLine());
   assertFalse(input.noDataAvailable());
   assertEquals("MiaoMiaoMiaoooooo", new String(input.getBytes(17)));
 }
 @Before
 public void setUp() throws ParseException {
   Configuration.INSTANCE.parse(null);
   fakeSelector = mock(SelectionKey.class);
   socketchannel = mock(SocketChannel.class);
   input = new TcpBufferReaderMock(fakeSelector);
   input.openChannel();
   when(fakeSelector.channel()).thenReturn(socketchannel);
 }
 @Test
 public void testClosedConnection() {
   try {
     input.precacheDataFromRemote();
   } catch (ClosedChannelException e) {
     return;
   } catch (IOException e) {
     fail();
   }
 }