public class ProxyUtil { @NotNull public static Proxy getProxy() { return new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("127.0.0.1", 1234)); } } 此处1234是SOCKS的代理端口。
WebSocket
1 2 3 4
public MyWebSocketApiBase(String uri, BaseGateway gateway) throws URISyntaxException { super(new URI(uri), new Draft_6455()); super.setProxy(ProxyUtil.getProxy()); }