public static Socket createSocket(InetAddress address,int port,boolean ssl) throws IOException {
  long start=System.currentTimeMillis();
  for (int i=0; ; i++) {
    try {
      if (ssl) {
        return CipherFactory.createSocket(address,port);
      }
      Socket socket=new Socket();
      socket.connect(new InetSocketAddress(address,port),SysProperties.SOCKET_CONNECT_TIMEOUT);
      return socket;
    }
 catch (    IOException e) {
      if (System.currentTimeMillis() - start >= SysProperties.SOCKET_CONNECT_TIMEOUT) {
        throw e;
      }
      if (i >= SysProperties.SOCKET_CONNECT_RETRY) {
        throw e;
      }
      try {
        long sleep=Math.min(256,i * i);
        Thread.sleep(sleep);
      }
 catch (      InterruptedException e2) {
      }
    }
  }
}

public static Socket createSocket ( InetAddress address , int port , boolean ssl ) throws IOException { long start = System . currentTimeMillis ( ) ; for ( int i = 0 ; ; i ++ ) { try { if ( ssl ) { return CipherFactory . createSocket ( address , port ) ; } Socket socket = new Socket ( ) ; socket . connect ( new InetSocketAddress ( address , port ) , SysProperties . SOCKET_CONNECT_TIMEOUT ) ; return socket ; } catch ( IOException e ) { if ( System . currentTimeMillis ( ) - start >= SysProperties . SOCKET_CONNECT_TIMEOUT ) { throw e ; } if ( i >= SysProperties . SOCKET_CONNECT_RETRY ) { throw e ; } try { long sleep = Math . min ( 256 , i * i ) ; Thread . sleep ( sleep ) ; } catch ( InterruptedException e2 ) { } } } }
create a client socket that is connected to the given address and port .
