question: public Thread connect ( ) throws IOException { this . running = true ; this . readyState = WEBSOCKET_STATE_CONNECTING ; socketChannel = SocketChannel . open ( ) ; socketChannel . configureBlocking ( false ) ; socketChannel . connect ( new InetSocketAddress ( uri . getHost ( ) , port ) ) ; System . setProperty ( "java.net.preferIPv4Stack" , "true" ) ; System . setProperty ( "java.net.preferIPv6Addresses" , "false" ) ; selector = Selector . open ( ) ; socketChannel . register ( selector , SelectionKey . OP_CONNECT ) ; Log . v ( "websocket" , "Starting a new thread to manage data reading/writing" ) ; Thread th = new Thread ( this ) ; th . start ( ) ; return th ; }
target:  Starts a new Thread and connects to server