source: class HttpClientTest {
  
      @Test
      public void newHttpURLConnection() throws Exception {
  
target:         {
              HttpClient httpClient = new HttpClient();
              HttpURLConnection httpURLConnection = httpClient.newHttpURLConnection(new URL("http://example.com"), HttpRequestMethod.GET, "utf-8");
              assertThat(httpURLConnection.getURL(), is(new URL("http://example.com")));
              assertThat(httpURLConnection.getDoInput(), is(true));
              assertThat(httpURLConnection.getDoOutput(), is(false));
              assertThat(httpURLConnection.getUseCaches(), is(false));
              assertThat(httpURLConnection.getRequestMethod(), is(not(nullValue())));
              assertThat(httpURLConnection.getRequestMethod().toUpperCase(), is("GET"));
              assertThat(httpURLConnection.getRequestProperties().size(), is(1));
              assertThat(httpURLConnection.getRequestProperties().containsKey(HttpHeaders.ACCEPT_CHARSET), is(true));
              assertThat(httpURLConnection.getRequestProperties().get(HttpHeaders.ACCEPT_CHARSET).size(), is(1));
              assertThat(httpURLConnection.getRequestProperties().get(HttpHeaders.ACCEPT_CHARSET).get(0), is("utf-8"));
          }
          {
              HttpClient httpClient = new HttpClient();
              HttpURLConnection httpURLConnection = httpClient.newHttpURLConnection(new URL("http://example.com"), HttpRequestMethod.POST, "utf-8");
              assertThat(httpURLConnection.getURL(), is(new URL("http://example.com")));
              assertThat(httpURLConnection.getDoInput(), is(true));
              assertThat(httpURLConnection.getDoOutput(), is(true));
              assertThat(httpURLConnection.getUseCaches(), is(false));
              assertThat(httpURLConnection.getRequestMethod(), is(not(nullValue())));
              assertThat(httpURLConnection.getRequestMethod().toUpperCase(), is("POST"));
              assertThat(httpURLConnection.getRequestProperties().size(), is(2));
              assertThat(httpURLConnection.getRequestProperties().containsKey(HttpHeaders.ACCEPT_CHARSET), is(true));
              assertThat(httpURLConnection.getRequestProperties().get(HttpHeaders.ACCEPT_CHARSET).size(), is(1));
              assertThat(httpURLConnection.getRequestProperties().get(HttpHeaders.ACCEPT_CHARSET).get(0), is("utf-8"));
              assertThat(httpURLConnection.getRequestProperties().containsKey(HttpHeaders.CONTENT_TYPE), is(true));
              assertThat(httpURLConnection.getRequestProperties().get(HttpHeaders.CONTENT_TYPE).size(), is(1));
              assertThat(httpURLConnection.getRequestProperties().get(HttpHeaders.CONTENT_TYPE).get(0), is("application/x-www-form-urlencoded;charset=utf-8"));
          }
      }
  
  }