### Question:
RegistryClient { public void configureBasicAuth() { Preconditions.checkNotNull(credential); Preconditions.checkState(!credential.isOAuth2RefreshToken()); authorization.set( Authorization.fromBasicCredentials(credential.getUsername(), credential.getPassword())); String registry = registryEndpointRequestProperties.getServerUrl(); String repository = registryEndpointRequestProperties.getImageName(); eventHandlers.dispatch( LogEvent.debug("configured basic auth for " + registry + "/" + repository)); } private  RegistryClient(
      EventHandlers eventHandlers,
      @Nullable Credential credential,
      RegistryEndpointRequestProperties registryEndpointRequestProperties,
      @Nullable String userAgent,
      FailoverHttpClient httpClient); static Factory factory(
      EventHandlers eventHandlers,
      String serverUrl,
      String imageName,
      FailoverHttpClient httpClient); static Factory factory(
      EventHandlers eventHandlers,
      String serverUrl,
      String imageName,
      String sourceImageName,
      FailoverHttpClient httpClient); void configureBasicAuth(); boolean doPullBearerAuth(); boolean doPushBearerAuth(); void authPullByWwwAuthenticate(String wwwAuthenticate); Optional<ManifestAndDigest<ManifestTemplate>> checkManifest(String imageQualifier); ManifestAndDigest<T> pullManifest(
      String imageQualifier, Class<T> manifestTemplateClass); ManifestAndDigest<ManifestTemplate> pullManifest(String imageQualifier); DescriptorDigest pushManifest(ManifestTemplate manifestTemplate, String imageTag); Optional<BlobDescriptor> checkBlob(DescriptorDigest blobDigest); Blob pullBlob(
      DescriptorDigest blobDigest,
      Consumer<Long> blobSizeListener,
      Consumer<Long> writtenByteCountListener); boolean pushBlob(
      DescriptorDigest blobDigest,
      Blob blob,
      @Nullable String sourceRepository,
      Consumer<Long> writtenByteCountListener);  }### Answer:
@Test public void testConfigureBasicAuth() throws IOException, InterruptedException, GeneralSecurityException, URISyntaxException, RegistryException { String basicAuth = "HTTP/1.1 200 OK\nContent-Length: 56789\n\n"; registry = new TestWebServer(false, Arrays.asList(basicAuth), 1); RegistryClient registryClient = createRegistryClient(Credential.from("user", "pass")); registryClient.configureBasicAuth(); Optional<BlobDescriptor> digestAndSize = registryClient.checkBlob(digest); Assert.assertEquals(56789, digestAndSize.get().getSize()); MatcherAssert.assertThat( registry.getInputRead(), CoreMatchers.containsString("Authorization: Basic dXNlcjpwYXNz")); }