package com.hsbc.wealth.srbp; import java.util.Map; import org.apache.http.HttpHost; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.CredentialsProvider; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @Component public class LoopAuth extends Thread { private static final Logger logger = LoggerFactory.getLogger(LoopAuth.class); Map<String, String> ctx = null; int sleepTime = 120000; @Override public void run() { logger.info("run()"); while (ctx == null) { try { logger.info("sleeping"); Thread.sleep(sleepTime/10); } catch (InterruptedException e) { logger.error("sleep failed", e); } } while (true) { callLogon(); try { Thread.sleep(sleepTime); } catch (InterruptedException e) { logger.error("callLogon failed", e); } } } private void callLogon() { String url = "https://devcluster.cert-proxy/v1/logon"; CredentialsProvider credsProvider = new BasicCredentialsProvider(); credsProvider.setCredentials(new AuthScope("intpxy1.hk.lin", 8080), new UsernamePasswordCredentials(ctx.get("account"), ctx.get("password"))); CloseableHttpClient httpclient = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build(); try { HttpHost target = new HttpHost(url); HttpHost proxy = new HttpHost("intpxy1.hk.lin", 8080); RequestConfig config = RequestConfig.custom().setProxy(proxy).build(); HttpPost httpRequest = new HttpPost(url); httpRequest.setConfig(config); httpRequest.addHeader("X-Locale", ctx.get("x-locale")); CloseableHttpResponse response = httpclient.execute(target, httpRequest); logger.info(EntityUtils.toString(response.getEntity())); } catch (Exception e) { logger.error("Cannot get auth.", e); } } @Override public void start() { super.start(); } }
相关推荐
apache Proxy Error apache Proxy Error apache Proxy Error apache Proxy Error
CMake配置生成opencv4的时候,... - http_proxy/https_proxy - and/or HTTP_PROXY/HTTPS_PROXY 可以下载本资源结合我的博文(https://editor.csdn.net/md/?articleId=121682921)进行配置就可以顺利成功解决问题了。
下载正版原版程序: https://www.charlesproxy.com/assets/release/4.2/charles-proxy-4.2-win64.msi https://www.charlesproxy.com/assets/release/4.2/charles-proxy-4.2-win32.msi ...
adb shell "su -c 'chmod 755 /system/xbin/dnsproxy2 /system/etc/init.d/20dnsproxy2'" adb shell "su -c 'mount -o ro,remount /system'" adb shell "su -c 'rm -f /data/local/tmp/dnsproxy2 /data/local/tmp/20...
WEBAPP ProxyMaster现在可通过 LINUX代理 ... wget https://github.com/thealphadollar/set_proxy/archive/master.zip 解压缩文件。 unzip master.zip 将目录更改为膨胀的存档文件夹。 cd set_proxy-
linux上的端口代理程序proxy -l 80 -h 93.184.216.119 -p 80 -i "tee input.log" -o "tee output.log"
summary: provides proxy tcp service for a host on an isolated network. programmer: Carl Harris (ceharris@vt.edu) date: 22 Feb 94 description: This code implements a daemon process ...
qzxdh代理设置小工具SetProxy
"Set browser Proxy" 指的就是这个过程,即自动配置浏览器以使用指定的代理服务器。 自动设置浏览器代理通常涉及以下步骤: 1. **了解代理服务器**:代理服务器是位于用户电脑和互联网之间的一个服务器,它可以...
安装curl https://raw.githubusercontent.com/EtherDream/jsproxy/0.1.0/i.sh | bash自动安装目前只支持Linux x64,并且需要root权限安装过程中80扩展能被外网访问(申请HTTPS证书)无法满足上述条件,或想了解安装...
官网下载的64位windows安装版 注册码: Registered Name: https://zhile.io License Key: 48891cf209c6d32bf4
node-http-proxy 是一个全功能的 Nginx 的 HTTP 代理扩展,支持 WebSocket 。
VC Proxy演示程序代码:是Visual C 专家门诊300问中的一个随书源码,简单的代理服务器程序,运行时提供代理服务,先启动服务才可以。来看一些参数定义: SOCKET user_proxy; //socket : 本地机器到PROXY 服务机 ...
foxyproxy_standard-7.5.1-an+fx.xpi
《GoProxy-Android:全能代理服务器在安卓平台的应用与实现》 GoProxy-Android是由snail007/goproxy团队开发的一款适用于安卓系统的全能代理服务器应用。此项目旨在为移动设备提供强大的网络代理功能,使得用户能够...
<password>proxy-password</password> </proxy> </proxies> ``` 这里的`<id>`是代理的唯一标识,`<active>`表示是否启用,`<protocol>`是代理协议(通常是http或https),`<host>`和`<port>`分别是代理服务器的...
firefox插件proxy_switchyomega-2.5.0官方签名网络快速切换代理插件,安全可靠,来源于官方插件商城下载保存,请放心使用。 安装方法: 附加组件 > 设置(插件搜索处左边齿轮) > 从文件安装附加组件,选择xpi包即可。