SSL Connection: timed out

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nickyeng
    Contributor
    • Nov 2006
    • 252

    SSL Connection: timed out

    Hi

    My program needs to connect to https server and here is my java code:
    Code:
    URL server = null;
    HttpURLConnection conn = null;
    try{
          System.setProperty("javax.net.ssl.keyStore", "eejis.jks");
    	System.setProperty("javax.net.ssl.keyStorePassword", "ee123");
    
         server = new URL("https", "123.123.1.1", 1234, path); 
         System.err.println("conn1...");
    	conn = (HttpURLConnection)server.openConnection();
    	System.err.println("conn2...");
    	conn.setRequestMethod("POST");
    		
    	System.err.println("conn3...");
    	conn.connect();    
    	System.err.println("conn4...");	
    }
    catch (ProtocolException e)
    {
    	System.out.println("protocalException:");
    	e.printStackTrace();
    }
    catch (IOException e)
    {
    	System.out.println("ioException:");
    	e.printStackTrace();
    }
    our client server need us to install some certificate and create keystore for it and use it in the program.
    I followed their steps and finally keystore is created eejis.jks.
    I put eejis.jks under the same directory of the program sits.

    The program give me the error below.
    In the programm i remove system.setPrope rty() lines, and run program also hit same error.
    It keeps telling me Connection : Timed Out

    It can open a connection but cannot use connect function?

    Can anyone tell me what's wrong?
    I ran out of idea.
    p.s: i still dont think the issue is from the keystore thing.


    Code:
    conn1...
    conn2...
    conn3...
    ioException:
    java.net.ConnectException: Connection timed out: connect
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.PlainSocketImpl.doConnect(Unknown Source)
            at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
            at java.net.PlainSocketImpl.connect(Unknown Source)
            at java.net.Socket.connect(Unknown Source)
            at java.net.Socket.connect(Unknown Source)
            at sun.net.NetworkClient.doConnect(Unknown Source)
            at sun.net.www.http.HttpClient.openServer(Unknown Source)
            at sun.net.www.http.HttpClient.openServer(Unknown Source)
            at sun.net.www.protocol.https.HttpsClient.<init>(Unknown Source)
            at sun.net.www.protocol.https.HttpsClient.New(Unknown Source)
            at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewH
    ttpClient(Unknown Source)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Sour
    ce)
            at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect
    (Unknown Source)
            at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Sou
    rce)
            at asiamsms.maxis.RequestProductForMaxis.getHttpUrlConnection(RequestPro
    ductForMaxis.java:196)
            at asiamsms.maxis.RequestProductForMaxis$RemindTask.run(RequestProductFo
    rMaxis.java:143)
            at java.util.TimerThread.mainLoop(Unknown Source)
            at java.util.TimerThread.run(Unknown Source)
Working...