Proxy is not setting programmatically when calling an API

Below is the code used to programmatically set the proxy while calling an API but API call is failing with connection timeout error. The API works when I manually set the proxy in Katalon Studio Preferences.
I have two API’s, one works with proxy and other works without proxy so i want to programmatically pass proxy in my script so that the API works without any connection issue.

RequestObject requestObject = findTestObject(“API/TokenEndpoint”)
ProxyInformation proxyInfo = new ProxyInformation();
proxyInfo.setProxyServerAddress(“XX.YY.ZZZ.14”)
proxyInfo.setProxyServerPort(‘80’)
proxyInfo.setProxyOption(ProxyOption.MANUAL_CONFIG.toString())
proxyInfo.setProxyServerType(ProxyServerType.HTTP.toString())
requestObject.setProxy(proxyInfo)
WS.sendRequest(requestObject)