LetsEncryptAcmeProvider extends AbstractAcmeProvider { @Override public URL resolve(URI serverUri) { String path = serverUri.getPath(); String directoryUrl; if (path == null || "".equals(path) || "/".equals(path) || "/v02".equals(path)) { directoryUrl = V02_DIRECTORY_URL; } else if ("/staging".equals(path)) { directoryUrl = STAGING_DIRECTORY_URL; } else { throw new IllegalArgumentException("Unknown URI " + serverUri); } try { return new URL(directoryUrl); } catch (MalformedURLException ex) { throw new AcmeProtocolException(directoryUrl, ex); } }  @Override boolean accepts(URI serverUri); @Override URL resolve(URI serverUri);  }
@Test public void testResolve() throws URISyntaxException { LetsEncryptAcmeProvider provider = new LetsEncryptAcmeProvider(); assertThat(provider.resolve(new URI("acme: assertThat(provider.resolve(new URI("acme: assertThat(provider.resolve(new URI("acme: assertThat(provider.resolve(new URI("acme: try { provider.resolve(new URI("acme: fail("accepted unknown path"); } catch (IllegalArgumentException ex) { } }