@Test
public void testOk() throws Exception {

	ByteArrayInputStream bin = new ByteArrayInputStream(
			"this is my test".getBytes());
	TimeoutInputStream in = new TimeoutInputStream(bin, 500l);
	DataInputStream data = new DataInputStream(in);
	byte[] buffer = new byte["this is my test".length()];
	data.readFully(buffer);
	assertEquals("this is my test", new String(buffer));
	try {
		data.read();
		fail("IllegalStateException expected");
	} catch (IllegalStateException e) {
		assertEquals("timeout", e.getMessage());
	}
	data.close();
}