public boolean isWifiFake ( String ipAddress , int port ) { SocketChannel socketChannel = null ; try { socketChannel = SocketChannel . open ( ) ; socketChannel . connect ( new InetSocketAddress ( ipAddress , port ) ) ; } catch ( IOException e ) { Log . d ( TAG , "Current Wifi is stupid!!! by IOException" ) ; return true ; } catch ( UnresolvedAddressException e ) { Log . d ( TAG , "Current Wifi is stupid!!! by InetSocketAddress" ) ; return true ; } finally { if ( socketChannel != null ) try { socketChannel . close ( ) ; } catch ( IOException e ) { Log . d ( TAG , "Error occured while closing SocketChannel" ) ; } } return false ; }
Checks if currently connected Access Point is either rogue or incapable of routing packet