BasicEndpointCaller implements EndpointCaller { @Override public InputStream getInputStream(Map<String, String> requestProperties, URL url) throws ODataClientRuntimeException { HttpURLConnection conn = getConnection(requestProperties, url); try { return conn.getInputStream(); } catch (IOException e) { conn.disconnect(); throw new ODataClientRuntimeException("Unable to get connection input stream for url: " + url, e); } } BasicEndpointCaller(Properties properties); @Override String callEndpoint(Map<String, String> requestProperties, URL urlToCall); @Override InputStream getInputStream(Map<String, String> requestProperties, URL url); @Override String doPostEntity(Map<String, String> requestProperties, URL urlToCall, String body,
                               MediaType contentType, MediaType acceptType); @Override String doPutEntity(Map<String, String> requestProperties, URL urlToCall, String body,
                              MediaType type); @Override void doDeleteEntity(Map<String, String> requestProperties, URL urlToCall);  }
@Test public void getInputStream() throws ODataClientException, IOException { URL url = new URL(basePath + RESPONSE); InputStream stream = caller.getInputStream(singletonMap("Accept", JSON.getType()), url ); StringBuilder sb = new StringBuilder(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) { String line; while ((line = reader.readLine()) != null) { sb.append(line).append(System.lineSeparator()); } } assertThat(sb.toString(), equalTo(URLTestUtils.loadTextFile(RESPONSE))); }