### Question:
AuthSupport { public static void extractFromAuthority( final String scheme, final URIAuthority authority, final CredentialsStore credentialsStore) { Args.notNull(credentialsStore, "Credentials store"); if (authority == null) { return; } final String userInfo = authority.getUserInfo(); if (userInfo == null) { return; } final int atColon = userInfo.indexOf(':'); final String userName = atColon >= 0 ? userInfo.substring(0, atColon) : userInfo; final char[] password = atColon >= 0 ? userInfo.substring(atColon + 1).toCharArray() : null; credentialsStore.setCredentials( new AuthScope(scheme, authority.getHostName(), authority.getPort(), null, StandardAuthScheme.BASIC), new UsernamePasswordCredentials(userName, password)); }  static void extractFromAuthority(
            final String scheme,
            final URIAuthority authority,
            final CredentialsStore credentialsStore); static HttpHost resolveAuthTarget(final HttpRequest request, final HttpRoute route);  }### Answer:
@Test public void testExtractFromAuthority() { final URIAuthority uriAuthority = new URIAuthority("testUser", "localhost", 8080); final BasicCredentialsProvider basicCredentialsProvider = new BasicCredentialsProvider(); AuthSupport.extractFromAuthority("http", uriAuthority, basicCredentialsProvider); final Credentials credentials = basicCredentialsProvider.getCredentials(new AuthScope("localhost", 8080), null); Assert.assertEquals("testUser", credentials.getUserPrincipal().getName()); Assert.assertNull(credentials.getPassword()); }