cometd-java/cometd-java-oort/src/main/java/org/cometd/oort/Oort.java
/**
     * @param handshake the handshake message to test
     * @return whether the given handshake message is coming from another Oort comet
     * that has been configured with the same {@link #setSecret(String) secret}
     * @see #isOort(ServerSession)
     */
@param handshake the handshake message to test
@return whether the given handshake message is coming from another Oort comet
that has been configured with the same  #setSecret(String) secret
@see #isOort(ServerSession)
@param handshake the handshake message to test @return whether the given handshake message is coming from another Oort comet that has been configured with the same #setSecret ( String ) secret @see #isOort ( ServerSession )
public boolean isOortHandshake(Message handshake) {
        if (!Channel.META_HANDSHAKE.equals(handshake.getChannel())) {
            return false;
        }
        Map<String, Object> ext = handshake.getExt();
        if (ext == null) {
            return false;
        }
        Object oortExtObject = ext.get(EXT_OORT_FIELD);
        if (!(oortExtObject instanceof Map)) {
            return false;
        }
        @SuppressWarnings("unchecked")
        Map<String, Object> oortExt = (Map<String, Object>)oortExtObject;
        String cometURL = (String)oortExt.get(EXT_COMET_URL_FIELD);
        if (!getURL().equals(cometURL)) {
            return false;
        }
        String b64RemoteSecret = (String)oortExt.get(EXT_OORT_SECRET_FIELD);
        String b64LocalSecret = encodeSecret(getSecret());
        return b64LocalSecret.equals(b64RemoteSecret);
    }
public boolean isOortHandshake ( Message handshake ) { if ( ! Channel . META_HANDSHAKE . equals ( handshake . getChannel ( ) ) ) { return false ; } Map < String , Object > ext = handshake . getExt ( ) ; if ( ext == null ) { return false ; } Object oortExtObject = ext . get ( EXT_OORT_FIELD ) ; if ( ! ( oortExtObject instanceof Map ) ) { return false ; } @ SuppressWarnings ( "unchecked" ) Map < String , Object > oortExt = ( Map < String , Object > ) oortExtObject ; String cometURL = ( String ) oortExt . get ( EXT_COMET_URL_FIELD ) ; if ( ! getURL ( ) . equals ( cometURL ) ) { return false ; } String b64RemoteSecret = ( String ) oortExt . get ( EXT_OORT_SECRET_FIELD ) ; String b64LocalSecret = encodeSecret ( getSecret ( ) ) ; return b64LocalSecret . equals ( b64RemoteSecret ) ; }
@param handshake the handshake message to test
 @return whether the given handshake message is coming from another Oort comet
 that has been configured with the same {@link #setSecret(String) secret}
 @see #isOort(ServerSession)
@param handshake the handshake message to test @return whether the given handshake message is coming from another Oort comet that has been configured with the same { @link #setSecret ( String ) secret } @see #isOort ( ServerSession )