在使用带有客户端证书和服务器身份验证的jetty http客户端进行ssl的http调用时,我收到以下错误。
java.io.EOFException: local close
at org.eclipse.jetty.client.HttpConnection.close(HttpConnection.java:651)
at org.eclipse.jetty.client.HttpConnection.handle(HttpConnection.java:361)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:535)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)
at java.lang.Thread.run(Thread.java:680)
在回复评论时添加完整错误:
FAILED: testNucleusOnline
java.util.concurrent.ExecutionException: Request failed exchange status:9 HTTP:0
at com.XXX.XXXX.IAbstractOperation.get(IAbstractOperation.java:26)
at com.XXX.XXXX.IAbstractOperation.get(IAbstractOperation.java:14)
at com.XXX.XXXX.XXXX.XXXXX.XXXXX(XXXXXX.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:74)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:673)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:846)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1170)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.runWorkers(TestRunner.java:1147)
at org.testng.TestRunner.privateRun(TestRunner.java:749)
at org.testng.TestRunner.run(TestRunner.java:600)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:317)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:312)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:274)
at org.testng.SuiteRunner.run(SuiteRunner.java:223)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1039)
at org.testng.TestNG.runSuitesLocally(TestNG.java:964)
at org.testng.TestNG.run(TestNG.java:900)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:110)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:205)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:174)
和代码有一些隐藏:
IAbstractOperation iAbstract = new IAbstractOperation();
iAbstract.setURL(availabilityUrl);
iAbstract.setMethod("GET");
if (iAbstract.startsWith("https:")) {
iAbstract.setScheme(HttpSchemes.HTTPS_BUFFER);
}
httpClient.send(iAbstract);
return iAbstract;
答案 0 :(得分:1)
基本上这意味着会话在SSL交换过程中已经关闭。这是代码:
public void close() throws IOException
{
//if there is a live, unfinished exchange, set its status to be
//excepted and wake up anyone waiting on waitForDone()
if (_exchange != null && !_exchange.isDone())
{
switch (_exchange.getStatus())
{
case HttpExchange.STATUS_CANCELLED:
case HttpExchange.STATUS_CANCELLING:
case HttpExchange.STATUS_COMPLETED:
case HttpExchange.STATUS_EXCEPTED:
case HttpExchange.STATUS_EXPIRED:
break;
default:
_exchange.setStatus(HttpExchange.STATUS_EXCEPTED);
_exchange.getEventListener().onException(new EOFException("local close"));
}
}
_endp.close();
}
很可能在完成SSL握手之前关闭连接是我解释的。我没有在堆栈跟踪上看到你的代码所以我对它发生的位置(客户端或服务器端)感到有点困惑。