@Test
    void testBasicAuthenticationFailureOnNonRepeatablePutDontExpectContinue() throws Exception {
        configureServerWithBasicAuth(bootstrap -> bootstrap
                .register("*", new EchoHandler()));
        final HttpHost target = startServer();

        final TestClient client = client();

        final RequestConfig config = RequestConfig.custom().setExpectContinueEnabled(false).build();
        final HttpPut httpput = new HttpPut("/");
        httpput.setConfig(config);
        httpput.setEntity(new InputStreamEntity(
                new ByteArrayInputStream(
                        new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9}),
                -1, null));

        final HttpClientContext context = HttpClientContext.create();
        final CredentialsProvider credsProvider = Mockito.mock(CredentialsProvider.class);
        Mockito.when(credsProvider.getCredentials(Mockito.any(), Mockito.any()))
                .thenReturn(new UsernamePasswordCredentials("test", "boom".toCharArray()));
        context.setCredentialsProvider(credsProvider);

        client.execute(target, httpput, context, response -> {
            final HttpEntity entity = response.getEntity();
            Assertions.assertEquals(401, response.getCode());
            Assertions.assertNotNull(entity);
            EntityUtils.consume(entity);
            return null;
        });
    }
Unit tests for automatic client authentication.
httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestClientAuthentication.java