UnsyncCharArrayReader extends Reader { @Override public void close() { _buffer = null; } UnsyncCharArrayReader(char[] chars);  UnsyncCharArrayReader(char[] chars, int offset, int length); @Override void close(); @Override void mark(int readAheadLimit); @Override boolean markSupported(); @Override int read(); @Override int read(char[] chars); @Override int read(char[] chars, int offset, int length); @Override int read(CharBuffer charBuffer); @Override boolean ready(); @Override void reset(); @Override long skip(long skip);  }
@Test public void testClose() throws Exception { UnsyncCharArrayReader unsyncCharArrayReader = new UnsyncCharArrayReader( _BUFFER); unsyncCharArrayReader.close(); Assert.assertNull(_bufferField.get(unsyncCharArrayReader)); try { unsyncCharArrayReader.read((CharBuffer)null); Assert.fail(); } catch (IOException ioException) { Assert.assertEquals("Stream closed", ioException.getMessage()); } testClose(unsyncCharArrayReader, "Stream closed"); }