AcmeUtils { public static String toAce(String domain) { Objects.requireNonNull(domain, "domain"); return IDN.toASCII(domain.trim()).toLowerCase(); } private  AcmeUtils(); static byte[] sha256hash(String z); static String hexEncode(byte[] data); static String base64UrlEncode(byte[] data); static byte[] base64UrlDecode(String base64); static boolean isValidBase64Url(@Nullable String base64); static String toAce(String domain); static Instant parseTimestamp(String str); @Nullable static String stripErrorPrefix(@Nullable String type); static void writeToPem(byte[] encoded, PemLabel label, Writer out); @Nullable static String getContentType(@Nullable String header); static void validateContact(URI contact);  }
@Test public void testToAce() { assertThat(toAce("example.com"), is("example.com")); assertThat(toAce(" example.com "), is("example.com")); assertThat(toAce("ExAmPlE.CoM"), is("example.com")); assertThat(toAce("foo.example.com"), is("foo.example.com")); assertThat(toAce("bar.foo.example.com"), is("bar.foo.example.com")); assertThat(toAce("ExÄmþle.¢öM"), is("xn--exmle-hra7p.xn--m-7ba6w")); assertThat(toAce("example\u3002com"), is("example.com")); assertThat(toAce("example\uff0ecom"), is("example.com")); assertThat(toAce("example\uff61com"), is("example.com")); assertThat(toAce("xn--exmle-hra7p.xn--m-7ba6w"), is("xn--exmle-hra7p.xn--m-7ba6w")); }