ServiceFromUrl extends ServiceExtractorImpl { @Override public InputStream getInputStream(AdaptrisMessage m) throws Exception { Args.notBlank(getUrl(), "url"); String urlToConnectTo = m.resolve(getUrl()); return URLHelper.connect(urlToConnectTo); } ServiceFromUrl();  ServiceFromUrl(String url); @Override InputStream getInputStream(AdaptrisMessage m); String getUrl(); void setUrl(String url);  }
@Test public void testGetInputStream() throws Exception { File f = createService(); String urlStyle = f.getCanonicalPath().replaceAll("\\\\", "/"); AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(); msg.addMetadata("location", urlStyle); ServiceFromUrl serviceExtractor = new ServiceFromUrl("file: try { LifecycleHelper.initAndStart(serviceExtractor); try (InputStream in = serviceExtractor.getInputStream(msg)) { assertNotNull(in); assertEquals(ServiceList.class, DefaultMarshaller.getDefaultMarshaller().unmarshal(in).getClass()); } } finally { LifecycleHelper.stopAndClose(serviceExtractor); } }