@Test
  public void shouldNotConnectWithoutCredentials() throws IOException {
    HttpConnectionUtil httpConnectionUtil = mockConnection();
    Rules rules = new Rules();
    Server server = new Server(rules, httpConnectionUtil);

    HttpURLConnection conn = mock(HttpURLConnection.class);
    when(httpConnectionUtil.getConnection(any(URL.class))).thenReturn(conn);
    when(conn.getContent()).thenReturn(new Object());

    server.getUrl(new URL("http://exmaple.org/"));

    verify(conn, never()).setRequestProperty(anyString(), anyString());
  }
  @Test
  public void shouldConnectWithCredentials() throws IOException {
    HttpConnectionUtil httpConnectionUtil = mockConnection();
    Rules rules = new Rules();
    Server server = new Server(rules, httpConnectionUtil);
    rules.setGoLogin("login");
    rules.setGoPassword("pass");

    HttpURLConnection conn = mock(HttpURLConnection.class);
    when(httpConnectionUtil.getConnection(any(URL.class))).thenReturn(conn);
    when(conn.getContent()).thenReturn(new Object());

    server.getUrl(new URL("http://exmaple.org/"));

    verify(conn).setRequestProperty("Authorization", "Basic bG9naW46cGFzcw==");
  }