static int findConnectPort ( List < InetSocketAddress > contactPoints ) { Set < Integer > ports = Sets . newLinkedHashSet ( ) ; for ( InetSocketAddress contactPoint : contactPoints ) { ports . add ( contactPoint . getPort ( ) ) ; } return ports . size ( ) == 1 ? ports . iterator ( ) . next ( ) : 9042 ; }
Returns the consistent port across all contact points or 9042