public void testConditionalGet() throws Exception {
URI feedUrl = new URI("http://rss.slashdot.org/Slashdot/slashdot/to");
IFeed feed = new Feed(feedUrl);
NotModifiedException e = null;
InputStream inS = new DefaultProtocolHandler().openStream(feed.getLink(), null);
assertNotNull(inS);
String ifModifiedSince = null;
String ifNoneMatch = null;
if (inS instanceof IConditionalGetCompatible) {
ifModifiedSince = ((IConditionalGetCompatible) inS).getIfModifiedSince();
ifNoneMatch = ((IConditionalGetCompatible) inS).getIfNoneMatch();
}
IConditionalGet conditionalGet = Owl.getModelFactory().createConditionalGet(ifModifiedSince, feedUrl, ifNoneMatch);
Map<Object, Object> conProperties = new HashMap<Object, Object>();
ifModifiedSince = conditionalGet.getIfModifiedSince();
if (ifModifiedSince != null)
conProperties.put(IConnectionPropertyConstants.IF_MODIFIED_SINCE, ifModifiedSince);
ifNoneMatch = conditionalGet.getIfNoneMatch();
if (ifNoneMatch != null)
conProperties.put(IConnectionPropertyConstants.IF_NONE_MATCH, ifNoneMatch);
try {
new DefaultProtocolHandler().openStream(feed.getLink(), conProperties);
} catch (NotModifiedException e1) {
e = e1;
}
assertNotNull(e);