From 76d57972f5f5b3a021e6ef76bfaa0aa36c33fba5 Mon Sep 17 00:00:00 2001 From: kowallen Date: Fri, 5 Jul 2024 10:23:28 +0200 Subject: [PATCH] Fixing a bug with proxy not being used while configured --- .../celonis/kafka/connect/ems/config/HttpClientConfig.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/connector/src/main/scala/com/celonis/kafka/connect/ems/config/HttpClientConfig.scala b/connector/src/main/scala/com/celonis/kafka/connect/ems/config/HttpClientConfig.scala index e1686dd..1815475 100644 --- a/connector/src/main/scala/com/celonis/kafka/connect/ems/config/HttpClientConfig.scala +++ b/connector/src/main/scala/com/celonis/kafka/connect/ems/config/HttpClientConfig.scala @@ -121,12 +121,14 @@ case class ProxiedHttpClientConfig( new Proxy(proxyType.javaProxyType, proxyAddr) } - override def customiseHttpClient(builder: OkHttpClient.Builder): OkHttpClient.Builder = + override def customiseHttpClient(builder: OkHttpClient.Builder): OkHttpClient.Builder = { + builder.proxy(createProxyServer()) authentication match { case Some(auth) if javaProxyType == JavaProxyType.HTTP => configureHttpProxyAuth(builder, auth) case Some(auth) if javaProxyType == JavaProxyType.SOCKS => configureSocksProxyAuth(auth); builder case _ => builder } + } private def configureSocksProxyAuth(auth: BasicAuthentication): Unit = JavaAuthenticator.setDefault(