Connecting via SOCKS proxy

219 views
Skip to first unread message

Krishna Priawan

unread,
Mar 25, 2022, 12:24:51 AM3/25/22
to Google Ads API and AdWords API Forum
Hi team,

I wasn't able to connect to Ads API while executing ListAccessibleCustomersResponse accessibleCustomers = customerServiceClient.listAccessibleCustomers(ListAccessibleCustomersRequest.newBuilder().build()); via SOCKS proxy (request hangs for about 1 hour) and got following exception from logs:
12:06:28 PM web.1 |  Mar 25, 2022 12:06:28 PM io.grpc.netty.shaded.io.grpc.netty.Utils getByteBufAllocator
12:06:28 PM web.1 |  FINE: Using custom allocator: forceHeapBuffer=false, defaultPreferDirect=true
12:06:28 PM web.1 |  Mar 25, 2022 12:06:28 PM io.grpc.netty.shaded.io.grpc.netty.Utils createByteBufAllocator
12:06:28 PM web.1 |  FINE: Creating allocator, preferDirect=true
12:06:28 PM web.1 |  Mar 25, 2022 12:06:28 PM io.grpc.netty.shaded.io.grpc.netty.Utils createByteBufAllocator
12:06:28 PM web.1 |  FINE: Forcing maxOrder=8
12:06:29 PM web.1 |  Mar 25, 2022 12:06:29 PM io.grpc.netty.shaded.io.grpc.netty.Utils getByteBufAllocator
12:06:29 PM web.1 |  FINE: Using custom allocator: forceHeapBuffer=false, defaultPreferDirect=true
...
1:06:17 PM web.1 |  INFO: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
1:06:17 PM web.1 |  Channel Pipeline: [HttpProxyHandler$HttpClientCodecWrapper#0, HttpProxyHandler#0, ProtocolNegotiators$ProxyProtocolNegotiationHandler#0, WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0]


When I disable sock proxy configuration, the connection was established successfully and able to retrieve the results.

Here's the snippet code that setup the SOCKS proxy protocol:
System.setProperty("socksNonProxyHosts", socksNonProxyHost);
URI proxyUri = new URI(socksProxy);
String proxyHost = proxyUri.getHost();
System.setProperty("socksProxyHost", proxyHost);
if (proxyUri.getPort() > 0) {
String proxyPort = "" + proxyUri.getPort();
System.setProperty("socksProxyPort", proxyPort);
}
if (proxyUri.getUserInfo() != null) {
String username = proxyUri.getUserInfo().split(":")[0];
String password = proxyUri.getUserInfo().split(":")[1];
Authenticator.setDefault(new ProxyAuth(username, password))
}

Does the library suppose to be working using Socks proxy? If yes, is there any workaround that I can implement on my end to resolve the issue? Thank you
--Krishna

Google Ads API Forum Advisor

unread,
Mar 25, 2022, 10:43:10 AM3/25/22
to krishna...@integrate.io, adwor...@googlegroups.com
Hi Krishna,

Thank you for reaching out to the Google Ads API support team.

To investigate the issue further, could you please provide the complete request and response logs, with the request-id?

If you haven't yet, logging can be enabled by navigating to the Client libraries > Your client library (ex. Java) > Logging documentation, which you can access from this link. You can provide it via Reply privately to author option. If this option is not available, then send it instead on this email address googleadsa...@google.com.


Thanks,
Google Logo
Nirmita
Google Ads API Team
 


ref:_00D1U1174p._5004Q2YrKqm:ref
Reply all
Reply to author
Forward
0 new messages