这个问题通常是由于使用了代理服务器而导致的。可以尝试在连接之前配置代理,或者关闭代理。
以下是一个配置代理的示例代码:
System.setProperty("https.proxyHost", "your-proxy-server.com");
System.setProperty("https.proxyPort", "proxy-port-number");
如果您使用的是系统级代理配置,您可以在应用程序中使用以下代码:
System.setProperty("java.net.useSystemProxies", "true");
如果您想禁用代理,请使用以下代码:
System.setProperty("https.proxyHost", null);
System.setProperty("https.proxyPort", null);