首页 > 编程语言 > 详细

java https客户端请求

时间:2017-05-14 17:43:17      阅读:424      评论:0      收藏:0      [点我收藏+]
String pathname = Test3.class.getResource("/client.jks").getFile();
System.out.println(pathname);
SSLContext sslContext = SSLContexts.custom()
				.loadTrustMaterial(new File(pathname), "123456".toCharArray(),
						new TrustSelfSignedStrategy())
				.build();
HttpGet request = new HttpGet("https://91ihealth.com:8443/");
HttpClient client = HttpClientBuilder.create()
				.setSslcontext(sslContext).build();
HttpResponse response = client.execute(request);
System.out.println(StreamUtils.copyToString(response.getEntity().getContent(), Charset.defaultCharset()));

  

java https客户端请求

原文:http://www.cnblogs.com/kingsy/p/6852874.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!