Jetty:客户端在收到请求的响应之前关闭TCP连接

时间:2013-10-31 14:49:20

标签: java iis jetty

我正在尝试使用Jetty Client(v9)向Microsoft IIS Webserver(5.1)发出POST请求。但是,这将导致客户端出现EOFException。在对wireshark进行一些调查之后,我发现在发送请求之后和响应到达之前,客户端立即关闭了TCP连接。

如果我向Tomcat-Server发出相同的请求,它可以完美地运行。

是否有人知道此问题或可能导致此问题的原因? Jetty中的错误?

客户端:

if (jettyClient != null) {
        if (jettyClient.isStarted()) {
            remoteHostname = httpAddress.getRemoteUrl().substring(7);
            serviceURI = httpAddress.getRemoteService();
            logger.debug("post an: " + httpAddress.getRemoteUrlPortService());
            Request request = jettyClient.POST(httpAddress.getRemoteUrlPortService());

            request.version(httpVersion);
            request.header(HttpHeader.CONTENT_TYPE, httpContentType);
            request.header(HttpHeader.CONTENT_LENGTH, Integer.toString(msg.length()));
            request.header(HttpHeader.HOST, remoteHostname + ":" + httpAddress.getRemotePort());
            request.timeout(httpTimeout, TimeUnit.MILLISECONDS); // 20000
            request.agent(ApplicationMeta.name + " " + ApplicationMeta.version);
            request.method(HttpMethod.POST);
            request.header("SOAPAction", soapAction);


            request.content(new StringContentProvider(msg));

            HTTPIncomingResponseSet set = null;

            try {
                ContentResponse response = request.send();
            } catch (ExecutionException e) {
              // ....
            }
}

0 个答案:

没有答案