PebbleAcmeProvider extends AbstractAcmeProvider { @Override public URL resolve(URI serverUri) { try { String path = serverUri.getPath(); URL baseUrl = new URL("https: if (path != null && !path.isEmpty() && !"/".equals(path)) { baseUrl = parsePath(path); } return baseUrl; } catch (MalformedURLException ex) { throw new IllegalArgumentException("Bad server URI " + serverUri, ex); } }  @Override boolean accepts(URI serverUri); @Override URL resolve(URI serverUri);  }
@Test public void testResolve() throws URISyntaxException { PebbleAcmeProvider provider = new PebbleAcmeProvider(); assertThat(provider.resolve(new URI("acme: is(url("https: assertThat(provider.resolve(new URI("acme: is(url("https: assertThat(provider.resolve(new URI("acme: is(url("https: assertThat(provider.resolve(new URI("acme: is(url("https: assertThat(provider.resolve(new URI("acme: is(url("https: try { provider.resolve(new URI("acme: fail("accepted bad port"); } catch (IllegalArgumentException ex) { } try { provider.resolve(new URI("acme: fail("accepted invalid path"); } catch (IllegalArgumentException ex) { } }