public static Socket createSocket(String server,int defaultPort,boolean ssl) throws IOException {
  int port=defaultPort;
  int startIndex=server.startsWith("[") ? server.indexOf(']') : 0;
  int idx=server.indexOf(':',startIndex);
  if (idx >= 0) {
    port=Integer.decode(server.substring(idx + 1));
    server=server.substring(0,idx);
  }
  InetAddress address=InetAddress.getByName(server);
  return createSocket(address,port,ssl);
}

public static Socket createSocket ( String server , int defaultPort , boolean ssl ) throws IOException { int port = defaultPort ; int startIndex = server . startsWith ( "[" ) ? server . indexOf ( ']' ) : 0 ; int idx = server . indexOf ( ':' , startIndex ) ; if ( idx >= 0 ) { port = Integer . decode ( server . substring ( idx + 1 ) ) ; server = server . substring ( 0 , idx ) ; } InetAddress address = InetAddress . getByName ( server ) ; return createSocket ( address , port , ssl ) ; }
create a client socket that is connected to the given address and port .
