Results 1 to 3 of 3
  1. #1
    thalupularavi is offline Member
    Join Date
    Feb 2010
    Rep Power

    Default Connection failure due to proxy problems

    Hi All,

    Please suggest me that how to identify that any connection failure exception is caused due to proxy problems. I mean how can i differentiate the other connection failures vs proxy.

    Objective: I have to display a message to user in my application (desktop app) saying that 'not able to connect to server due to proxy problems' if any problems occured in connecting to a site due to local proxy issues.

    and also displaying different messages for connection request time out, session time out and etc.

    Please let suggest the approach or any example will be greatly appreciated.

    Thanks in advance.
    -Ravi T

  2. #2
    FON is offline Senior Member
    Join Date
    Dec 2009
    Belgrade, Serbia
    Rep Power


    Can this help:

    Java Tips - How to detect Proxy Settings for Internet Connection

    Check javadoc for ProxySelector class

    there is method:

    Java Code:
    public abstract void connectFailed(URI uri,
                                       SocketAddress sa,
                                       IOException ioe)
    Called to indicate that a connection could not be established to a proxy/socks server. 
    An implementation of this method can temporarily remove the proxies or reorder
     the sequence of proxies returned by select(String, String), using the address and they kind of IOException given.

  3. #3
    thalupularavi is offline Member
    Join Date
    Feb 2010
    Rep Power

    Default Required more info

    Hi FON,

    Thanks for your quick response. I have implemented custom proxy select to override connectFailed() method. But it never called, even if i given incorrect proxy host name.

    Can you please suggest that how can i validate given proxy details and identify the problem.

    Please find my sample code in attachments.

    When i have tested the program with valid proxy host, port and incorrect credentials of proxy. It is displaying response like below. Which is expected behaviour and useful for me.

    Response msg=Proxy Authentication Required
    Response Code=407

    Ravi T
    Attached Files Attached Files

Similar Threads

  1. Replies: 12
    Last Post: 02-17-2010, 08:50 AM
  2. SQLException: Communications link failure
    By etherkye in forum JDBC
    Replies: 0
    Last Post: 07-03-2009, 05:20 PM
  3. Connect to HTTPS + SSL handshake failure
    By jamojo in forum Advanced Java
    Replies: 3
    Last Post: 06-26-2009, 12:04 AM
  4. Animation failure...
    By lordbob75 in forum New To Java
    Replies: 10
    Last Post: 05-11-2009, 03:06 AM
  5. Http - proxy or non-proxy ?
    By Shiv in forum Networking
    Replies: 0
    Last Post: 04-11-2009, 09:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts