    @Test
    public void getProjectArchiveWithRedirect()
            throws IOException, InterruptedException
    {

        String redirectUrl = String.format("https://%s:%d/redirect/pathname", mockWebServer.getHostName(), mockWebServer.getPort());
        mockWebServer.enqueue(new MockResponse().setResponseCode(303).setHeader("Location", redirectUrl));
        mockWebServer.enqueue(new MockResponse().setResponseCode(200).setBody("foobar"));
        InputStream archive = client.getProjectArchive(Id.of("42"), "12345678-abcdef");
        assertArrayEquals("foobar".getBytes(UTF_8), Streams.readAll(archive));
        assertThat(mockWebServer.getRequestCount(), is(2));
        assertThat(mockWebServer.takeRequest().getPath(), is("/api/projects/42/archive?revision=12345678-abcdef"));
        assertThat(mockWebServer.takeRequest().getPath(), is("/redirect/pathname"));
    }