@Test public void testAddsAuthorization() throws Exception { mockWebServer.enqueue(new MockResponse().setResponseCode(200).setBody("yay!")); HashMap<String, String> headers = new HashMap<>(); headers.put("Authorization", "Bearer eeeekeeeeek"); headers.put("other_header", "foo"); headers.put("other_header2", "bar"); SimpleUrlConnectionFactory urlFactory = new SimpleUrlConnectionFactory(headers); InputStream inputStream = urlFactory.getStream(Uri.parse(baseUrl.toString())); Assert.assertEquals(1, mockWebServer.getRequestCount()); RecordedRequest request = mockWebServer.takeRequest(); Assert.assertNotNull(request.getHeader("Authorization")); Assert.assertNotNull(request.getHeader("other_header")); Assert.assertNotNull(request.getHeader("other_header2")); }
public InputStream getStream(Uri uri) throws IOException { return createConnection(uri, null, 0); }
SimpleUrlConnectionFactory implements UrlFactory { public InputStream getStream(Uri uri) throws IOException { return createConnection(uri, null, 0); } }
SimpleUrlConnectionFactory implements UrlFactory { public InputStream getStream(Uri uri) throws IOException { return createConnection(uri, null, 0); } SimpleUrlConnectionFactory();  SimpleUrlConnectionFactory(Map<String, String> requestProps); }
SimpleUrlConnectionFactory implements UrlFactory { public InputStream getStream(Uri uri) throws IOException { return createConnection(uri, null, 0); } SimpleUrlConnectionFactory();  SimpleUrlConnectionFactory(Map<String, String> requestProps); InputStream getStream(Uri uri); }
SimpleUrlConnectionFactory implements UrlFactory { public InputStream getStream(Uri uri) throws IOException { return createConnection(uri, null, 0); } SimpleUrlConnectionFactory();  SimpleUrlConnectionFactory(Map<String, String> requestProps); InputStream getStream(Uri uri);  }