@Test
public void testIncompleteReadFully() {

  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() * 2];
  try {
    IOUtils.readFully(reader, buffer, 0);
    fail();
  } catch (IOException e) {
    // expected
  }
  // reset the stream
  stream = new ByteArrayInputStream(bytes);
  reader = new InputStreamReader(stream);
  try {
    IOUtils.readFully(reader, buffer, myMessage.length()/2);
    fail();
  } catch (IOException e) {
    // expected
  }
}