Try jcabi-http
, which is a fluent Java HTTP client, for example:
String html = new JdkRequest("https://www.google.com")
.header(HttpHeaders.ACCEPT, MediaType.TEXT_HTML)
.fetch()
.as(HttpResponse.class)
.assertStatus(HttpURLConnection.HTTP_OK)
.body();
Check also this blog post: http://www.yegor256.com/2014/04/11/jcabi-http-intro.html