private static MetaStream getMetaStream(InputStream stream) {
        if (stream instanceof MetaStream) {
            return (MetaStream) stream;
        }
        if (!(stream instanceof ByteLimitedInputStream)) {
            throw new IllegalStateException("Given unknown stream type.");
        }
        //Ooooooo this is so ugly
        try {
            ByteLimitedInputStream byteLimitedInputStream = (ByteLimitedInputStream) stream;
            Field f = byteLimitedInputStream.getClass().getDeclaredField("wrappedStream"); //NoSuchFieldException
            f.setAccessible(true);
            return (MetaStream) f.get(byteLimitedInputStream);
        } catch (Exception e) {
            throw new IllegalStateException("Implementation of ByteLimitedInputStream has changed.", e);
        }
    }
Mock for ExternalFeedTestCase which had to override package private methods.

@author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a>
vespaclient-container-plugin/src/test/java/com/yahoo/vespaxmlparser/MockReader.java