@Test
public void testRedirects() throws Exception {

    mockWebServer.enqueue(new MockResponse().setResponseCode(301).
            setBody("redirect").setHeader("Location", baseUrl + "/fooey"));
    mockWebServer.enqueue(new MockResponse().setResponseCode(200).setBody("yay!"));
    SimpleUrlConnectionFactory urlFactory = new SimpleUrlConnectionFactory();
    InputStream inputStream = urlFactory.getStream(Uri.parse(baseUrl.toString()));
    Assert.assertEquals(2, mockWebServer.getRequestCount());
}