### Question:
DecoderInputStream extends InputStream { @Override public int read() throws IOException { int i = in.read(); if (i >= 0) { limit--; } assertLimit(); return i; } DecoderInputStream(InputStream in);  DecoderInputStream(InputStream in, int limit); int available(); void close(); void mark(int readlimit); boolean markSupported(); @Override int read(); @Override int read(byte[] b, int off, int len); @Override long skip(long n); void reset(); int getLimit(); void setLimit(int limit); ByteOrder getByteOrder(); void setByteOrder(ByteOrder byteOrder); byte readByte(); int readInt(); int readUnsignedShort(); final short readShort(); String readString(Charset charset); String readString(int length, Charset charset);  }### Answer:
@Test public void boundingTest() throws IOException { InputStream in = new ByteArrayInputStream(new byte[] {0, 1}); InputStream din = new DecoderInputStream(in, 1); din.read(); try { din.read(); Assert.fail("Should have thrown indicating limit exceeded"); } catch (IllegalStateException e) { } }