SimpleServiceIdentityProvider implements ServiceIdentityProvider { String getServerHostName() { String urlhost; try { InetAddress localhost = getLocalHost(); urlhost = localhost.getCanonicalHostName(); } catch (java.net.UnknownHostException e) { urlhost = "localhost"; } return urlhost; } SimpleServiceIdentityProvider(String domainName, String serviceName,
            PrivateKey privateKey, String keyId);  SimpleServiceIdentityProvider(String domainName, String serviceName,
            PrivateKey privateKey, String keyId, long tokenTimeout);  SimpleServiceIdentityProvider(Authority authority, String domainName,
            String serviceName, PrivateKey privateKey, String keyId, long tokenTimeout); Principal getIdentity(String domainName, String serviceName); String getHost(); void setHost(String host); void setTokenTimeout(long tokenTimeout); Authority getAuthority(); void setAuthority(Authority authority);  }
@Test public void testGetServerHostName() throws UnknownHostException { PrivateKey key = Crypto.loadPrivateKey(servicePrivateKeyStringK1); SimpleServiceIdentityProvider simpleServiceIdentityProvider = new SimpleServiceIdentityProvider("coretech", "athenz", key, "1"); SimpleServiceIdentityProvider provider = Mockito.spy(simpleServiceIdentityProvider); doThrow(UnknownHostException.class).when(provider).getLocalHost(); assertEquals(provider.getServerHostName(), "localhost"); }