@Test public void testTimeoutException() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectEncoderOutputStream oeos = new ObjectEncoderOutputStream(new DataOutputStream(baos), 512); List<Integer> obj = Arrays.asList(1, 2, 3); oeos.writeObject(obj); oeos.close(); final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); InputStream is = new InputStream() { int count; @Override public int read() throws IOException { if (count++%2==0) { throw new SocketTimeoutException(); } return bais.read(); } }; ObjectDecoderInputStream odis = new ObjectDecoderInputStream(new AccessibleBufferedInputStream(is, 1024), Thread.currentThread().getContextClassLoader(), 1024); Object result = null; do { try { result = odis.readObject(); } catch (IOException e) { } } while (result == null); assertEquals(obj, result); }
@Override public void close() throws IOException { in.close(); }
ObjectDecoderInputStream extends ObjectInputStream { @Override public void close() throws IOException { in.close(); } }
ObjectDecoderInputStream extends ObjectInputStream { @Override public void close() throws IOException { in.close(); } ObjectDecoderInputStream(AccessibleBufferedInputStream in, ClassLoader classLoader, int maxObjectSize); }
ObjectDecoderInputStream extends ObjectInputStream { @Override public void close() throws IOException { in.close(); } ObjectDecoderInputStream(AccessibleBufferedInputStream in, ClassLoader classLoader, int maxObjectSize); @Override void close(); }
ObjectDecoderInputStream extends ObjectInputStream { @Override public void close() throws IOException { in.close(); } ObjectDecoderInputStream(AccessibleBufferedInputStream in, ClassLoader classLoader, int maxObjectSize); @Override void close();  }