Commit 6ed3ae61 authored by jim's avatar jim

release

parent 17eb5a06
package com.edgec.browserbackend.common.utils;
import com.edgec.browserbackend.common.commons.utils.NotifyUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
......@@ -43,6 +44,7 @@ public class Trans {
/**
* 主入口方法
*
* @param args
*/
public static void main(String[] args) {
......@@ -56,7 +58,7 @@ public class Trans {
httpClient.getCredentialsProvider().setCredentials(
new AuthScope(host, port),
new UsernamePasswordCredentials(username, password));
HttpHost proxy = new HttpHost(host,port);
HttpHost proxy = new HttpHost(host, port);
httpClient.getParams().setParameter(ConnRouteParams.DEFAULT_PROXY, proxy);
return httpClient;
}
......@@ -76,13 +78,11 @@ public class Trans {
HttpEntity entry = response.getEntity();
if(entry != null)
{
if (entry != null) {
InputStreamReader is = new InputStreamReader(entry.getContent());
BufferedReader br = new BufferedReader(is);
String str = null;
while((str = br.readLine()) != null)
{
while ((str = br.readLine()) != null) {
sb.append(str.trim());
}
br.close();
......@@ -96,6 +96,8 @@ public class Trans {
NotifyUtils.sendMessage("防关联浏览器 ip " + host + " 代理异常", e, NotifyUtils.MsgType.WEBHOOK);
logger.error(e.getMessage(), e);
return "";
} finally {
httpGet.releaseConnection();
}
return sb.toString();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment