Establishing the URLConnection to another web application does not work with URLConnection .connect()?
===

Here is the code i am using the open the URLConnection to another webapllication 

    try {	
     URL   url = new URL("https://mySecondWebApp/Cart");
     HttpsURLConnection conn1 = (HttpsURLConnection) url.openConnection();//line1
     conn1 .connect();//line 2 does not establishes the connection
     reply.load(conn1.getInputStream());// line 3 works which means that i get control to my app2 in debugger.But I don't want to use this line instead of line 1 as i am not reading any thing from conn1 . I am not getting why line 2 is not working
     }
      catch (MalformedURLException e) {
        log.error("MalformedURLException" + e);

      }
      catch (IOException e) {

      log.info("getting IO error");
      }


i just want to establish the the connection to my second webapplication. Basically i don't return  any output from second app.
What is happening is, connection gets established successfully at line 3 instead of line 2(**should not connection get established at line 2 ?**). 
**I am not getting why connection is no getting established at line 2 ? line 3 works extablishes the connection to app 2 succeefully but i do not want to use it as once line 3 executes , i get control inside ioexception block which is dirty code and want to avoid. Thats why i am keen on using conn1 .connect() which is just to trigger the control to application 2**