HttpGet httpGet = new HttpGet(url);
SSLContext sslcontext = SSLContexts.custom()
.loadTrustMaterial(TrustSelfSignedStrategy.INSTANCE).build();

RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(3000)
.setConnectionRequestTimeout(3000).setSocketTimeout(3000).build();

CloseableHttpClient httpclient = HttpClients.custom().setSSLContext(sslcontext)
.setSSLHostnameVerifier(new MyHostnameVerifier())
.setDefaultRequestConfig(requestConfig).build();

CloseableHttpResponse response = httpclient.execute(httpGet);

常用代码块:创建httpclient的更多相关文章

  1. vs2015常用代码块与自定义代码块

    常用代码块 代码段名 描    述 #if 该代码段用#if和#endif命令围绕代码 #region 该代码段用#region和#endregion命令围绕代码 ~ 该代码段插入一个析构函数 att ...

  2. 关于Hbuild引用mui常用代码块以及部分控件.

    MUI-最接近原生APP体验的高性能前端框架, 追求性能体验,是我们开始启动MUI项目的首要目标,轻量必然是重要特征: MUI不依赖任何第三方JS库,压缩后的JS和CSS文件仅有100+K和60+K, ...

  3. 常用代码块:创建httpclient 2

    HttpGet httpGet = new HttpGet(url);SSLContext sslcontext = SSLContexts.custom().loadTrustMaterial(ne ...

  4. Xcode常用代码块

    Xcode的代码片段(Code Snippets)创建自定义的代码片段,当你重用这些代码片段时,会给你带来很大的方便. 常用的: 1.strong:@property (nonatomic,stron ...

  5. VC常用代码之创建进程

    作者:朱金灿 来源:http://blog.csdn.net/clever101 创建进程是编程开发的常用操作.Windows中的创建进程采用API函数CreateProcess实现.下面是一个使用例 ...

  6. iOS开发常用代码块(第二弹)

    GCD定时器 dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, ); dispat ...

  7. iOS开发常用代码块(2)

    GCD定时器 dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispa ...

  8. iOS 常用代码块

    1.判断邮箱格式是否正确的代码: // 利用正则表达式验证 -( BOOL )isValidateEmail:( NSString  *)email {   NSString  *emailRegex ...

  9. GCD的常用代码块

    一.队列 1.获取全局的并发队列 dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, ...

随机推荐

  1. android-pull方式解析xml文件以及XML文件的序列化

    android解析XML ---------------------------基础要像磐石 在android平台上可以使用SAX.DOM和自带的Pull解析器解析xml文件,本文主要介绍使用pull ...

  2. Spring事务的传播行为 @Transactional

    Spring事务的传播行为http://blog.csdn.net/cuker919/article/details/5957209 在service类前加上@Transactional,声明这个se ...

  3. Spring Boot整合shiro-登录认证和权限管理

    原文地址:http://www.ityouknow.com/springboot/2017/06/26/springboot-shiro.html 这篇文章我们来学习如何使用Spring Boot集成 ...

  4. linux 实时显示文件的内容

    1. watch -n 1 aa.txt  #每个1秒显示aa.txt的内容 2. tail -f ***.log Linux shell中有一个tail命令,常用来显示一个文件的最后n行文档内容 但 ...

  5. 459. Repeated Substring Pattern【easy】

    459. Repeated Substring Pattern[easy] Given a non-empty string check if it can be constructed by tak ...

  6. vs2015创建webService

  7. spring+redis+nginx 实现分布式session共享

    1,spring 必须是4.3以上版本的 2,maven配置 添加两个重要的依赖 <dependency> <groupId>org.springframework.sessi ...

  8. 可以开发着玩一下的web项目

    博客项目:发布博客,写博客 车辆.车队管理系统 教师评价系统 仓储管理系统 进销存管理系统 客户管理系统 结算系统 医院病历管理系统

  9. IOS设计模式浅析之建造者模式(Builder)

    定义 "将一个复杂对象的构建与它的表现分离,使得同样的构建过程可以创建不同的表现". 最初的定义出现于<设计模式>(Addison-Wesley,1994). 看这个概 ...

  10. ptmalloc、tcmalloc和jemalloc

    内存优化总结:ptmalloc.tcmalloc和jemalloc 转载 2017年09月05日 18:57:12 3674 转载于:http://www.cnhalo.net/2016/06/13/ ...