3

I am using Jetty HTTP client to send request via HTTPS, I configured the HTTP client to use SSL as the following:

httpClient = new HttpClient(new SslContextFactory());
httpClient.setFollowRedirects(false);
httpClient.start();

Request request = httpClient.newRequest(url);
request.method(HttpMethod.GET);
response = request.send();  

httpClient.stop();

But I got this exception:

java.util.concurrent.ExecutionException: java.nio.channels.ClosedChannelException
    at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:118)
    at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:101)
    at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:653)
    at egm.httpClient.jetty.TestBackend.POST(TestBackend.java:206)
    at egm.httpClient.jetty.TestStep.execute(TestStep.java:77)
    at egm.httpClient.jetty.TestSuite.execute(TestSuite.java:57)
    at egm.httpClient.jetty.TestLauncher.main(TestLauncher.java:139)
Caused by: java.nio.channels.ClosedChannelException
    at org.eclipse.jetty.io.FillInterest.onClose(FillInterest.java:135)
    at org.eclipse.jetty.io.AbstractEndPoint.onClose(AbstractEndPoint.java:116)
    at org.eclipse.jetty.io.SelectorManager.endPointClosed(SelectorManager.java:295)
    at org.eclipse.jetty.io.ManagedSelector$2.run(ManagedSelector.java:432)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
    at java.lang.Thread.run(Unknown Source)
sabrina2020
  • 2,102
  • 3
  • 25
  • 54

0 Answers0