Buggy code:
public static final int EVENT = 36 ; public static final int METAEVENT = 36 ; public static final int REGISTER = 64 ; public static final int REGISTERED = 65 ; public static final int UNREGISTER = 66 ; public static final int UNREGISTERED = 67 ; public static final int CALL = 48 ; public static final int CANCEL_CALL = 49 ; public static final int CALL_RESULT = 50 ; public static final int INVOCATION = 68 ; public static final int INTERRUPT = 69 ; public static final int YIELD = 70 ; public static long newGlobalScopeId ( ) { } public static long newRouterScopeId ( ) { } public static long newSessionScopeId ( WampSocket clientSocket ) { } private static void sendWampMessage ( WampSocket socket , WampList args ) { } public static void sendHelloMessage ( WampSocket clientSocket , String realm , WampDict options ) { } public static void sendWelcomeMessage ( WampApplication app , WampSocket clientSocket ) { } public static void sendChallengeMessage ( WampSocket clientSocket , String authMethod , WampDict extra ) { } public static void sendAuthenticationMessage ( WampSocket clientSocket , String signature , WampDict extra ) { } public static void sendAbortMessage ( WampSocket clientSocket , String reason , String message ) { } public static void sendGoodbyeMessage ( WampSocket clientSocket , String reason , String message ) { } public static void sendHeartbeatMessage ( WampSocket clientSocket , String discard ) { } public static void sendResultMessage ( WampSocket clientSocket , Long requestId , WampDict details , WampList args , WampDict argsKw ) { } public static void sendSubscribeMessage ( WampSocket clientSocket , Long requestId , String topicURI , WampSubscriptionOptions options ) { } public static void sendSubscribedMessage ( WampSocket clientSocket , Long requestId , Long subscriptionId ) { } public static void sendUnsubscribeMessage ( WampSocket clientSocket , Long requestId , Long unsubscriptionId ) { } public static void sendUnsubscribedMessage ( WampSocket clientSocket , Long requestId ) { } public static void sendPublishMessage ( WampSocket clientSocket , Long requestId , String topic , WampList payload , WampDict payloadKw , WampDict options ) { } public static void sendPublishedMessage ( WampSocket clientSocket , Long requestId , Long publicationId ) { } public static void sendEvents ( String realm , Long publicationId , WampTopic topic , WampList payload , WampDict payloadKw , Set < Long > eligibleParam , Set < Long > excluded , Long publisherId , String publisherAuthId , String publisherAuthProvider , String publisherAuthRole ) throws Exception { } public static void sendMetaEvents ( String realm , Long publicationId , WampTopic topic , String metaTopic , Set < Long > eligible , WampDict metaEvent ) throws Exception { metaEvent . put ( "metatopic" , metaTopic ) ; Long toClient = ( ( eligible != null ) && ( ( eligible . size ( ) ) > 0 ) ) ? eligible . iterator ( ) . next ( ) : null ; for ( WampSubscription subscription : topic . getSubscriptions ( ) ) { if ( ( subscription . getOptions ( ) . getMatchType ( ) ) == ( WampMatchType . exact ) ) { metaEvent . remove ( "topic" ) ; } else { metaEvent . put ( "topic" , topic . getTopicName ( ) ) ; } WampList response = new WampList ( ) ; response . add ( WampProtocol . METAEVENT ) ; response . add ( subscription . getId ( ) ) ; response . add ( publicationId ) ; response . add ( metaEvent ) ; if ( toClient != null ) { WampSocket remoteSocket = subscription . getSocket ( toClient ) ; if ( ( remoteSocket != null ) && ( realm . equals ( remoteSocket . getRealm ( ) ) ) ) { WampProtocol . sendWampMessage ( remoteSocket , response ) ; } } else { if ( ( ( subscription . getOptions ( ) ) != null ) && ( subscription . getOptions ( ) . hasMetaTopic ( metaTopic ) ) ) { Object [ ] msg = new Object [ WampEncoding . values ( ) . length ] ; for ( Long sid : subscription . getSessionIds ( realm ) ) { WampSocket remoteSocket = subscription . getSocket ( sid ) ; <START_BUG> if ( ( realm . equals ( remoteSocket . getRealm ( ) ) ) && ( remoteSocket . supportVersion ( WAMPv2 ) ) ) { <END_BUG> WampEncoding enc = remoteSocket . getEncoding ( ) ; if ( ( msg [ enc . ordinal ( ) ] ) == null ) { msg [ enc . ordinal ( ) ] = enc . getSerializer ( ) . serialize ( response ) ; } remoteSocket . sendObject ( msg [ enc . ordinal ( ) ] ) ; } } } } } } public static void sendErrorMessage ( WampSocket clientSocket , int requestType , Long requestId , WampDict details , String errorUri , WampList args , WampDict argsKw ) { } public static void sendCallMessage ( WampSocket clientSocket , Long requestId , WampDict options , String procedureURI , WampList args , WampDict argsKw ) { } public static void sendCancelCallMessage ( WampSocket clientSocket , Long callId , WampDict options ) { } public static void sendRegisterMessage ( WampSocket clientSocket , Long requestId , WampDict options , String procedureURI ) { } public static void sendRegisteredMessage ( WampSocket clientSocket , Long requestId , Long registrationId ) { } public static void sendUnregisterMessage ( WampSocket clientSocket , Long requestId , Long registrationId ) { } public static void sendUnregisteredMessage ( WampSocket clientSocket , Long requestId ) { } public static void sendInvocationMessage ( WampSocket remotePeer , Long invocationId , Long registrationId , WampDict details , WampList args , WampDict argsKw ) { } public static void sendInvocationResultMessage ( WampSocket clientSocket , Long invocationRequestId , WampDict invocationResultOptions , WampList result , WampDict resultKw ) { } public static void sendInterruptMessage ( WampSocket remotePeer , Long invocationId , WampDict cancelOptions ) { } }

Fix:
if ( ( ( remoteSocket != null ) && ( realm . equals ( remoteSocket . getRealm ( ) ) ) ) && ( remoteSocket . supportVersion ( WAMPv2 ) ) ) {