Session { public URI getServerUri() { return serverUri; } Session(String serverUri);  Session(URI serverUri);  Session(URI serverUri, AcmeProvider provider); Login login(URL accountLocation, KeyPair accountKeyPair); URI getServerUri(); @Nullable String getNonce(); void setNonce(@Nullable String nonce); Locale getLocale(); void setLocale(@Nullable Locale locale); @Deprecated Proxy getProxy(); @Deprecated void setProxy(@Nullable Proxy proxy); NetworkSettings networkSettings(); AcmeProvider provider(); Connection connect(); URL resourceUrl(Resource resource); Metadata getMetadata(); @Nullable ZonedDateTime getDirectoryLastModified(); void setDirectoryLastModified(@Nullable ZonedDateTime directoryLastModified); @Nullable ZonedDateTime getDirectoryExpires(); void setDirectoryExpires(@Nullable ZonedDateTime directoryExpires); boolean hasDirectory();  }
@Test public void testConstructor() { URI serverUri = URI.create(TestUtils.ACME_SERVER_URI); try { new Session((URI) null); fail("accepted null parameters in constructor"); } catch (NullPointerException ex) { } Session session = new Session(serverUri); assertThat(session, not(nullValue())); assertThat(session.getServerUri(), is(serverUri)); Session session2 = new Session(TestUtils.ACME_SERVER_URI); assertThat(session2, not(nullValue())); assertThat(session2.getServerUri(), is(serverUri)); Session session3 = new Session(serverUri, new GenericAcmeProvider()); assertThat(session3, not(nullValue())); assertThat(session3.getServerUri(), is(serverUri)); try { new Session("#*aBaDuRi*#"); fail("accepted bad URI in constructor"); } catch (IllegalArgumentException ex) { } try { new Session(URI.create("acme: fail("Provider accepted unsupported URI"); } catch (IllegalArgumentException ex) { } }