代码中加入:
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpHost proxy = new HttpHost("localhost", 8888, "http");//8888位Fidder中的端口号位置为
Fidder--tools--connections
RequestConfig config = RequestConfig.custom().setProxy(proxy).build();
HttpPost httpPost = new HttpPost(url);//此处也可以是HpptGet等其他方式
httpPost.setConfig(config);