Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-dev] Exception with Jetty HttpClient when using proxy

Reading all documentation, and googling everywhere I cannot figure out why this code has the exception; I try all....

It's a Jetty Client using an HttpProxy (Https over http, so it will use CONNECT against the proxy). This runs OK without proxy configured:

 
  SslContextFactory sslContextFactory = new SslContextFactory();
        sslContextFactory.setTrustAll(Boolean.TRUE);
        sslContextFactory.setEndpointIdentificationAlgorithm(null);
        httpclient = new HttpClient(sslContextFactory);
        httpclient.setFollowRedirects(false);
        httpclient.setConnectTimeout(45000);
        ProxyConfiguration proxyConfig = httpclient.getProxyConfiguration();
        proxyConfig.getProxies().add( new HttpProxy("myproxy.somewhere.com",7011) );
        httpclient.start();
        ...
        ...
          ContentResponse response;
            response = httpclient.newRequest("https://somesite.com")
                    .method(HttpMethod.GET).send();

        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        } catch (TimeoutException e) {
            e.printStackTrace();
        }


        And I have this

        java.util.concurrent.ExecutionException: org.eclipse.jetty.io.EofException
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:639)
at com.eurobits.agregador.comun.http.HttpJettyRequest.requestURI(HttpJettyRequest.java:145)
at com.eurobits.agregador.particulares.bancos.caixa.CaixaLogin.login(CaixaLogin.java:129)
at com.eurobits.agregador.particulares.bancos.caixa.CaixaLogin.tryLogin(CaixaLogin.java:97)
at com.eurobits.agregador.comun.Login.doLogin(Login.java:128)
at com.eurobits.agregador.particulares.ParticularesParserCard.firstPhase(ParticularesParserCard.java:290)
at com.eurobits.agregador.particulares.ParticularesParserCard.buildXMLStandarExecute(ParticularesParserCard.java:253)
at com.eurobits.agregador.particulares.ParticularesParserCard.buildXML(ParticularesParserCard.java:228)
at com.eurobits.agregador.comun.Parser.getOutput(Parser.java:974)
at com.eurobits.agregador.comun.BusinessFacadeImpl.execute(BusinessFacadeImpl.java:34)
at com.eurobits.agregador.RobotTest.execute(RobotTest.java:439)
at com.eurobits.agregador.RobotTest.testExecute(RobotTest.java:460)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
Caused by: org.eclipse.jetty.io.EofException
at org.eclipse.jetty.io.ChannelEndPoint.flush(ChannelEndPoint.java:192)
at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.flush(SslConnection.java:782)
at org.eclipse.jetty.io.WriteFlusher.write(WriteFlusher.java:337)
at org.eclipse.jetty.io.AbstractEndPoint.write(AbstractEndPoint.java:128)
at org.eclipse.jetty.client.http.HttpSenderOverHTTP.sendHeaders(HttpSenderOverHTTP.java:108)
at org.eclipse.jetty.client.HttpSender.send(HttpSender.java:190)
at org.eclipse.jetty.client.http.HttpChannelOverHTTP.send(HttpChannelOverHTTP.java:54)
at org.eclipse.jetty.client.http.HttpConnectionOverHTTP$Delegate.send(HttpConnectionOverHTTP.java:182)
at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.send(HttpConnectionOverHTTP.java:70)
at org.eclipse.jetty.client.http.HttpDestinationOverHTTP.send(HttpDestinationOverHTTP.java:36)
at org.eclipse.jetty.client.http.HttpDestinationOverHTTP.send(HttpDestinationOverHTTP.java:26)
at org.eclipse.jetty.client.PoolingHttpDestination$2.run(PoolingHttpDestination.java:132)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:610)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:539)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.nio.channels.ClosedChannelException
at sun.nio.ch.SocketChannelImpl.ensureWriteOpen(SocketChannelImpl.java:265)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:474)
at org.eclipse.jetty.io.ChannelEndPoint.flush(ChannelEndPoint.java:170)
... 14 more


--

Ernesto Arroyo Ron, CISSP, CISA, CISM

Eurobits Technologies
Calle Musgo 3, 1ª Planta
28023 Madrid
ernesto.arroyo@xxxxxxxxxxx
http://www.eurobits.com


Back to the top