UrlUtil { public static URLConnection open(final URL url) throws IOException { LOGGER.trace("Opening {}.", url); final URLConnection con = url.openConnection(); con.setConnectTimeout((int) Settings.INSTANCE.getConnectionTimeout() .toMillis()); con.setReadTimeout((int) Settings.INSTANCE.getSocketTimeout() .toMillis()); return con; } private  UrlUtil(); static URL toURL(final String string); static URLConnection open(final URL url);  }
@Test void openCorrectUrl() throws IOException { var connection = UrlUtil.open(new URL("http: assertSoftly(softly -> { softly.assertThat(connection.getReadTimeout()) .isEqualTo(Settings.INSTANCE.getSocketTimeout() .toMillis()); softly.assertThat(connection.getConnectTimeout()) .isEqualTo(Settings.INSTANCE.getConnectionTimeout() .toMillis()); }); }