I am trying to get some data from a web server that works fine with http.
But when I try https (ssl connection), I get exceptions as below.
I get an http status code 200 and a response length of 2230. That's right.
java.net.SocketException: Socket is closed at sun.security.ssl.SSLSocketImpl.checkEOF(SSLSocketImpl.java:1483) at sun.security.ssl.AppInputStream.read(AppInputStream.java:92) at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:166) at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:90) at org.apache.http.impl.io.AbstractSessionInputBuffer.read(AbstractSessionInputBuffer.java:183) at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:144) at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:121)
My code is as follows: apache httpcomponents httpclient (4.2.5).
try { HttpPost httppost = new HttpPost(uri); HttpHost targetHost = new HttpHost(HOST_NAME, HOST_PORT, PROTOCOL); InputStreamEntity reqEntity = new InputStreamEntity(new ByteArrayInputStream(request), -1); String contentType = TSPConstants.CONST_TSA_CONTENT_TYPE_TSREQUEST; reqEntity.setContentType(contentType); reqEntity.setChunked(true);
source share