question: private void connect ( String host , int port ) throws QueryException , IOException { socket = Utils . createSocket ( urlParser , host ) ; initializeSocketOption ( ) ; if ( options . localSocketAddress != null ) { InetSocketAddress localAddress = new InetSocketAddress ( options . localSocketAddress , 0 ) ; socket . bind ( localAddress ) ; } if ( ! socket . isConnected ( ) ) { InetSocketAddress sockAddr = urlParser . getOptions ( ) . pipe == null ? new InetSocketAddress ( host , port ) : null ; if ( options . connectTimeout != null ) { socket . connect ( sockAddr , options . connectTimeout ) ; } else { socket . connect ( sockAddr ) ; } } if ( options . socketTimeout != null ) { socket . setSoTimeout ( options . socketTimeout ) ; } handleConnectionPhases ( ) ; if ( options . useCompression ) { writer . setUseCompression ( true ) ; packetFetcher = new ReadPacketFetcher ( new DecompressInputStream ( socket . getInputStream ( ) ) , options . maxQuerySizeToLog ) ; } connected = true ; writer . forceCleanupBuffer ( ) ; loadServerData ( ) ; setSessionOptions ( ) ; writer . setMaxAllowedPacket ( Integer . parseInt ( serverData . get ( "max_allowed_packet" ) ) ) ; createDatabaseIfNotExist ( ) ; loadCalendar ( ) ; activeStreamingResult = null ; moreResults = false ; hasWarnings = false ; hostFailed = false ; }
target:  Connect the client and perform handshake.