From 80b6cbfc9c861469146318d0b3dd5f8b8b525b8a Mon Sep 17 00:00:00 2001 From: xiejun <xiejun@vci-tech.com> Date: 星期五, 01 十一月 2024 15:11:19 +0800 Subject: [PATCH] Revert "集成获取mdm分发通用数据格式接口集成" --- Source/BladeX-Tool/blade-starter-http/src/test/java/org/springblade/core/http/test/BladeProxySelector.java | 61 ++++++++++++++++++++++++++++++ 1 files changed, 61 insertions(+), 0 deletions(-) diff --git a/Source/BladeX-Tool/blade-starter-http/src/test/java/org/springblade/core/http/test/BladeProxySelector.java b/Source/BladeX-Tool/blade-starter-http/src/test/java/org/springblade/core/http/test/BladeProxySelector.java new file mode 100644 index 0000000..83e8900 --- /dev/null +++ b/Source/BladeX-Tool/blade-starter-http/src/test/java/org/springblade/core/http/test/BladeProxySelector.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2018-2028, DreamLu All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: DreamLu 鍗㈡槬姊� (596392912@qq.com) + */ +package org.springblade.core.http.test; + +import lombok.extern.slf4j.Slf4j; + +import java.io.IOException; +import java.net.*; +import java.util.ArrayList; +import java.util.List; + +/** + * 浠g悊璁剧疆 + * + * @author L.cm + */ +@Slf4j +public class BladeProxySelector extends ProxySelector { + + @Override + public List<Proxy> select(URI uri) { + // 娉ㄦ剰浠g悊閮戒笉鍙敤 + List<Proxy> proxyList = new ArrayList<>(); + proxyList.add(getProxy("127.0.0.1", 8080)); + proxyList.add(getProxy("127.0.0.1", 8081)); + proxyList.add(getProxy("127.0.0.1", 8082)); + proxyList.add(getProxy("127.0.0.1", 3128)); + return proxyList; + } + + @Override + public void connectFailed(URI uri, SocketAddress address, IOException ioe) { + // 娉ㄦ剰锛氱粡杩囨祴璇曪紝姝ゅ涓嶄細瑙﹀彂 + log.error("ConnectFailed uri:{}, address:{}, ioe:{}", uri, address, ioe); + } + + /** + * 鏋勯�� Proxy + * + * @param host host + * @param port 绔彛 + * @return Proxy 瀵硅薄 + */ + public static Proxy getProxy(String host, int port) { + return new Proxy(Proxy.Type.HTTP, InetSocketAddress.createUnresolved(host, port)); + } +} -- Gitblit v1.9.3