Skip to content

Commit 7964032

Browse files
test: fix issue with netty proxy not allowing localhost as proxy on linux
1 parent b74c3ac commit 7964032

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

api/src/test/java/io/kafbat/ui/config/auth/OAuthTestSupport.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,20 @@ public static synchronized void ensureStarted(boolean enableProxy) {
100100
if (enableProxy) {
101101
System.setProperty("http.proxyHost", "localhost");
102102
System.setProperty("http.proxyPort", String.valueOf(proxyServer.port()));
103+
// Override default nonProxyHosts ("localhost|127.*|[::1]") to allow proxying localhost for tests
104+
System.setProperty("http.nonProxyHosts", "none");
103105
} else {
104106
System.clearProperty("http.proxyHost");
105107
System.clearProperty("http.proxyPort");
108+
System.clearProperty("http.nonProxyHosts");
106109
}
107110
proxyEnabled = enableProxy;
108111
}
109112

110113
public static void stopServers() {
111114
System.clearProperty("http.proxyHost");
112115
System.clearProperty("http.proxyPort");
116+
System.clearProperty("http.nonProxyHosts");
113117
if (proxyServer != null) {
114118
proxyServer.stop();
115119
proxyServer = null;

0 commit comments

Comments
 (0)