@Test
public void testReadFully() throws Exception {

  String myMessage = "{this is my message}";
  byte[] bytes = myMessage.getBytes(Charsets.UTF_8);
  InputStream stream = new ByteArrayInputStream(bytes);
  Reader reader = new InputStreamReader(stream);
  char[] buffer = new char[myMessage.length()];
  IOUtils.readFully(reader, buffer, 0);
  for (int i = 0; i < myMessage.length(); i++) {
    assertEquals(buffer[i], myMessage.charAt(i));
  }
}