What causes HttpHostConnectException?

后端 未结 3 1941
没有蜡笔的小新
没有蜡笔的小新 2021-02-01 07:30

I have a Auto Complete/type ahead feature on Search for my website. I see that some time their is an exception associated with it. We are using a proxy server.



        
相关标签:
3条回答
  • 2021-02-01 07:38

    A "connection refused" error happens when you attempt to open a TCP connection to an IP address / port where there is nothing currently listening for connections. If nothing is listening, the OS on the server side "refuses" the connection.

    If this is happening intermittently, then the most likely explanations are (IMO):

    • the server you are talking ("proxy.xyz.com" / port 60) to is going up and down, OR
    • there is something1 between your client and the proxy that is intermittently sending requests to a non-functioning host, or something.

    Is this possible that this exception is caused when a search request is made from Android applications as our website don't support a request is being made from android applications.

    It seems unlikely. You said that the "connection refused" exception message says that it is the proxy that is refusing the connection, not your server. Besides if a server was going to not handle certain kinds of request, it still has to accept the TCP connection to find out what the request is ... before it can reject it.


    1 - For example, it could be a DNS that round-robin resolves the DNS name to different IP addresses. Or it could be an IP-based load balancer.

    0 讨论(0)
  • 2021-02-01 07:38

    In my case the issue was a missing 's' in the HTTP URL. Error was: "HttpHostConnectException: Connect to someendpoint.com:80 [someendpoint.com/127.0.0.1] failed: Connection refused" End point and IP obviously changed to protect the network.

    0 讨论(0)
  • 2021-02-01 08:03

    You must set proxy server for gradle at some time, you can try to change the proxy server ip address in gradle.properties which is under .gradle document

    0 讨论(0)
提交回复
热议问题