### Question:
HttpRetriever { @Deprecated public HttpResult execute(HttpRequest request) throws HttpException { Validate.notNull(request, "request must not be null"); HttpUriRequest httpRequest; String url; switch (request.getMethod()) { case GET: url = createUrl(request); httpRequest = new HttpGet(url); break; case POST: url = request.getUrl(); HttpPost httpPost = new HttpPost(url); HttpEntity entity; if (request.getHttpEntity() != null) { entity = request.getHttpEntity(); } else { List<NameValuePair> postParams = new ArrayList<>(); for (Entry<String, String> param : request.getParameters().entrySet()) { postParams.add(new BasicNameValuePair(param.getKey(), param.getValue())); } entity = new UrlEncodedFormEntity(postParams, request.getCharset()); } httpPost.setEntity(entity); httpRequest = httpPost; break; case HEAD: url = createUrl(request); httpRequest = new HttpHead(url); break; case DELETE: url = createUrl(request); httpRequest = new HttpDelete(url); break; case PUT: url = request.getUrl(); HttpPut httpPut = new HttpPut(url); if (request.getHttpEntity() != null) { entity = request.getHttpEntity(); } else { List<NameValuePair> postParams = new ArrayList<>(); for (Entry<String, String> param : request.getParameters().entrySet()) { postParams.add(new BasicNameValuePair(param.getKey(), param.getValue())); } entity = new UrlEncodedFormEntity(postParams, request.getCharset()); } httpPut.setEntity(entity); httpRequest = httpPut; break; default: throw new IllegalArgumentException("Unimplemented method: " + request.getMethod()); } for (Entry<String, String> header : request.getHeaders().entrySet()) { httpRequest.setHeader(header.getKey(), header.getValue()); } return execute(url, httpRequest); } HttpRetriever(ClientConnectionManager connectionManager); HttpResult httpGet(String url); HttpResult httpHead(String url); HttpResult httpHead(String url, Map<String, String> headers); @Deprecated HttpResult execute(HttpRequest request); HttpResult execute(HttpRequest2 request); List<String> getRedirectUrls(String url); boolean downloadAndSave(String url, String filePath); boolean downloadAndSave(String url, String filePath, boolean includeHttpResponseHeaders); boolean downloadAndSave(String url, String filePath, Map<String, String> requestHeaders,
                                   boolean includeHttpResponseHeaders); void setConnectionTimeout(int connectionTimeout); void setSocketTimeout(int socketTimeout); void setNumRetries(int numRetries); void setUserAgent(String userAgent); void setMaxFileSize(long maxFileSize); void setCookieStore(CookieStore cookieStore); static long getTraffic(SizeUnit unit); static void resetTraffic(); void setProxyProvider(ProxyProvider proxyProvider); ProxyProvider getProxyProvider(); void setConnectionTimeoutRedirects(int connectionTimeoutRedirects); void setSocketTimeoutRedirects(int socketTimeoutRedirects); Set<Integer> getProxyRemoveStatusCodes(); void setProxyRemoveStatusCodes(Set<Integer> proxyRemoveStatusCodes); ProxyRemoverCallback getProxyRemoveCallback(); void setProxyRemoveCallback(ProxyRemoverCallback proxyRemoveCallback); static final String USER_AGENT; static final int DEFAULT_CONNECTION_TIMEOUT; static final int DEFAULT_CONNECTION_TIMEOUT_REDIRECTS; static final int DEFAULT_SOCKET_TIMEOUT; static final int MAX_REDIRECTS; static final int DEFAULT_SOCKET_TIMEOUT_REDIRECTS; static final int DEFAULT_NUM_RETRIES; }### Answer:
@Test @Ignore public void testGetHttpRequest2() throws HttpException { HttpRequest2 request = new HttpRequest2Builder(ws.palladian.retrieval.HttpMethod.GET, "http: HttpResult result = HttpRetrieverFactory.getHttpRetriever().execute(request); System.out.println(result.getStringContent()); }