5

I am calling an email marketing service with a huge body(html). The size of the body = 117184.

I am using AsyncHttpClient which uses Netty as background.

When I call the request directly, it is successful but it fails with the following exception when I try to use an internal https proxy server. But a small body with proxy server works fine. Following is the scala code :

val client = asyncHttpClient(config().setProxyServer(proxyServer("XX-XYXY-100X.XXXX.local", 8080)))
val whenResponse = client.preparePost("https://api.sendgrid.com/v3/mail/send")
  .addHeader("Authorization", "Bearer XXXXXXXXX")
  .addHeader("Content-Type", "application/json")
  .setBody(randomBody)
  .execute
  .get(1000, TimeUnit.SECONDS)

Basically :

  • large body and no proxy server : works fine.
  • small body and with and without proxy server : works fine.
  • large body with proxy server : DOESN'T WORK.

I see the following exception for requests with large body using proxy server.

Exception in thread "main" java.util.concurrent.ExecutionException: javax.net.ssl.SSLException: handshake timed out
    at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
    at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915)
    at org.asynchttpclient.netty.NettyResponseFuture.get(NettyResponseFuture.java:207)
    at send.RequestSender$.send1(RequestSender.scala:27)
    at send.RequestSender$.delayedEndpoint$send$RequestSender$1(RequestSender.scala:47)
    at send.RequestSender$delayedInit$body.apply(RequestSender.scala:14)
    at scala.Function0.apply$mcV$sp(Function0.scala:34)
    at scala.Function0.apply$mcV$sp$(Function0.scala:34)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
    at scala.App.$anonfun$main$1$adapted(App.scala:76)
    at scala.collection.immutable.List.foreach(List.scala:389)
    at scala.App.main(App.scala:76)
    at scala.App.main$(App.scala:74)
    at send.RequestSender$.main(RequestSender.scala:14)
    at send.RequestSender.main(RequestSender.scala)
Caused by: javax.net.ssl.SSLException: handshake timed out
    at io.netty.handler.ssl.SslHandler.handshake(...)(Unknown Source)
N A
  • 831
  • 2
  • 8
  • 28

1 Answers1

2

I've reported this issue : https://github.com/AsyncHttpClient/async-http-client/issues/1559

And their developers were quick to fix the issue.

This issue can be fixed by upgrading to version greater than 2.5.2

N A
  • 831
  • 2
  • 8
  • 28