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

    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
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    364
    Rep Power
    5

    Default

    Can this help:

    Java Tips - How to detect Proxy Settings for Internet Connection

    Check javadoc for ProxySelector class

    there is method:

    Java Code:
    [B]connectFailed[/B]
    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
    Posts
    7
    Rep Power
    0

    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


    Thanks,
    Ravi T
    Attached Files Attached Files

Similar Threads

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