title: Getting java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode
body: <p>I've created a test for the creation of a new user:</p>
  
  <pre><code>private static String USERS_ENDPOINT = "http://localhost:8080/users/";
  private static String GROUPS_ENDPOINT = "http://localhost:8080/groups/";
  
  @Test
  @DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD)
  public void whenCreateAppUser() {
  
      AppUser appUser = new AppUser();
      appUser.setUsername("test@example.com");
      appUser.setPassword("password");
  
      // Throws java.net.HttpRetryException
      template.postForEntity(USERS_ENDPOINT, appUser, AppUser.class);
  
      ResponseEntity&lt;AppUser&gt; appUserResponse = template.getForEntity(USERS_ENDPOINT + "1/", AppUser.class);
  
      assertEquals("Username is incorrect. AppUser not created?",
              appUser.getUsername(), appUserResponse.getBody().getUsername());
  }
  </code></pre>
  
  <p>However, for some reason I am getting:</p>
  
  <pre><code>Caused by: java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1692)
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
      at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
      at org.springframework.http.client.SimpleClientHttpResponse.getRawStatusCode(SimpleClientHttpResponse.java:55)
      at org.springframework.web.client.DefaultResponseErrorHandler.hasError(DefaultResponseErrorHandler.java:49)
      at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:735)
      at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:700)
      ... 34 more
  </code></pre>
  
  <p>For the call</p>
  
  <pre><code>template.postForEntity(USERS_ENDPOINT, appUser, AppUser.class);
  </code></pre>
  
  <p>I actually don't know what I changed because this used to work for me. Any idea what causes this issue?</p>
  
  <hr>
  
  <p>My <code>WebSecurity</code> settings are:</p>
  
  <pre><code>@Override
  public void configure(WebSecurity web) throws Exception {
  
      final String[] SWAGGER_UI = {
              "/swagger-resources/**",
              "/swagger-ui.html",
              "/v2/api-docs",
              "/webjars/**"
      };
  
      web.ignoring().antMatchers("/pub/**", "/users")
              .antMatchers(SWAGGER_UI);
  }
  </code></pre>