Less
Less

Reputation: 3207

HttpClient won't connect on port 993?

I had a Tomcat instance setup to listen on port 80xx. It hosts a REST service. I did the client side tests using WizTools RESTClient 3.2, and it was going fine. Then, I was asked to switch the server's listening port to 993, which is regularly reserved for IMAPS (don't ask why..).

Literally the only thing changed in the setup was the connector port. Now, RESTClient fails with the following exception:

Connection reset
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
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.readLine(AbstractSessionInputBuffer.java:281)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:92)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:62)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:254)
at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:289)
at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:252)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:191)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:300)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:127)
at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:715)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:520)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
at org.wiztools.restclient.HTTPClientRequestExecuter.execute(HTTPClientRequestExecuter.java:387)
at org.wiztools.restclient.ui.RESTViewImpl$2.run(RESTViewImpl.java:322)

Subsequently, it showed that wget, curl and telnet work fine on the changed port (993), so it must be a HttpClient issue (used in the application).

Can someone tell what could be the reason for this behavior...?

Upvotes: 1

Views: 375

Answers (1)

Welsh
Welsh

Reputation: 5468

I tried running a bare apache tomcat instance on port 993 and then on 994.

What I've found is that Google Chrome was able to access 994 but not 993 because its a restricted port for IMAPS. (Fun Fact that I didn't know: All browsers block these non-standard HTTP ports because they pose a security risk. For example, you can view here a list of all restricted ports for Google Chrome if you scroll down to line 94.)

Using WizTools RESTClient 3.2.1 for a Mac works for me but this is locally. Depending on your network there could be something going on Network/firewall wise which would be weird because curl and etc. are working, So I don't think its an actual issue with HttpClient because it should act like curl and etc. does. Maybe it is with 3.2 and not 3.2.1.

See:

enter image description here

Upvotes: 3

Related Questions