### Question:
AmbariServer { public static void setupProxyAuth() { final String proxyUser = System.getProperty("http.proxyUser"); final String proxyPass = System.getProperty("http.proxyPassword"); if (null != proxyUser && null != proxyPass) { LOG.info("Proxy authentication enabled"); Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(proxyUser, proxyPass.toCharArray()); } }); } else { LOG.debug("Proxy authentication not specified"); } }  String getServerOsType(); static AmbariManagementController getController(); static void setController(AmbariManagementController controller); @SuppressWarnings("deprecation") void run(); void stop(); @Deprecated void performStaticInjection(); void initViewRegistry(); static void setupProxyAuth(); static void enableLog4jMonitor(Map<String, String> configsMap); static void main(String[] args); static final String VIEWS_URL_PATTERN; static final EnumSet<DispatcherType> DISPATCHER_TYPES; volatile boolean running; }### Answer:
@Test public void testProxyUser() throws Exception { PasswordAuthentication pa = Authenticator.requestPasswordAuthentication( InetAddress.getLocalHost(), 80, null, null, null); Assert.assertNull(pa); System.setProperty("http.proxyUser", "abc"); System.setProperty("http.proxyPassword", "def"); AmbariServer.setupProxyAuth(); pa = Authenticator.requestPasswordAuthentication( InetAddress.getLocalHost(), 80, null, null, null); Assert.assertNotNull(pa); Assert.assertEquals("abc", pa.getUserName()); Assert.assertArrayEquals("def".toCharArray(), pa.getPassword()); }