### Question:
ClientMain { static CompletionStage<String> followRedirects(WebClient webClient) { System.out.println("Following request redirection."); return webClient.get() .path("/redirect") .request() .thenCompose(response -> { if (response.status() != Http.Status.OK_200) { throw new IllegalStateException("Follow redirection failed!"); } return response.content().as(String.class); }) .thenCompose(string -> { System.out.println("Redirected request successfully followed."); System.out.println(string); return CompletableFuture.completedFuture(string); }); } private  ClientMain(); static void main(String[] args);  }### Answer:
@Test public void testPerformRedirect() throws ExecutionException, InterruptedException { createWebClient(ServerMain.getServerPort(), new RedirectClientServiceTest()); ClientMain.followRedirects(webClient) .thenAccept(it -> assertThat(it, is("{\"message\":\"Hello World!\"}"))) .toCompletableFuture() .get(); }