Identifier implements Serializable { public InetAddress getIP() { if (!TYPE_IP.equals(type)) { throw new AcmeProtocolException("expected 'ip' identifier, but found '" + type + "'"); } try { return InetAddress.getByName(value); } catch (UnknownHostException ex) { throw new AcmeProtocolException("bad ip identifier value", ex); } } Identifier(String type, String value);  Identifier(JSON json); static Identifier dns(String domain); static Identifier ip(InetAddress ip); static Identifier ip(String ip); String getType(); String getValue(); String getDomain(); InetAddress getIP(); Map<String, Object> toMap(); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); static final String TYPE_DNS; static final String TYPE_IP; }
@Test(expected = AcmeProtocolException.class) public void testNoIp() { new Identifier("foo", "example.com").getIP(); }