Source:
private void dispatchWebSocketMethod(PatternPathRouter.RoutableDestination<Object> routableEndpoint, CarbonMessage carbonMessage) throws WebSocketEndpointAnnotationException { Session session = (Session) carbonMessage.getProperty(Constants.WEBSOCKET_SESSION); if (session == null) { throw new NullPointerException("WebSocket session not found."); } if (carbonMessage instanceof TextCarbonMessage) { TextCarbonMessage textCarbonMessage = (TextCarbonMessage) carbonMessage; handleTextWebSocketMessage(textCarbonMessage, routableEndpoint, session); } else if (carbonMessage instanceof BinaryCarbonMessage) { BinaryCarbonMessage binaryCarbonMessage = (BinaryCarbonMessage) carbonMessage; handleBinaryWebSocketMessage(binaryCarbonMessage, routableEndpoint, session); } else if (carbonMessage instanceof StatusCarbonMessage) { StatusCarbonMessage statusCarbonMessage = (StatusCarbonMessage) carbonMessage; if (statusCarbonMessage.getStatus().equals(org.wso2.carbon.messaging.Constants.STATUS_OPEN)) { String connection = (String) carbonMessage.getProperty(Constants.CONNECTION); String upgrade = (String) carbonMessage.getProperty(Constants.UPGRADE); if (Constants.UPGRADE.equalsIgnoreCase(connection) && Constants.WEBSOCKET_UPGRADE.equalsIgnoreCase(upgrade)) { handleWebSocketHandshake(carbonMessage, session); } } else if (statusCarbonMessage.getStatus().equals(org.wso2.carbon.messaging.Constants.STATUS_CLOSE)) { handleCloseWebSocketMessage(statusCarbonMessage, routableEndpoint, session); } } else if (carbonMessage instanceof ControlCarbonMessage) { ControlCarbonMessage controlCarbonMessage = (ControlCarbonMessage) carbonMessage; handleControlCarbonMessage(controlCarbonMessage, routableEndpoint, session); } }

Target:
private void dispatchWebSocketMethod(PatternPathRouter.RoutableDestination<Object> routableEndpoint, CarbonMessage carbonMessage) throws WebSocketEndpointAnnotationException { Session session = (Session) carbonMessage.getProperty(Constants.WEBSOCKET_SESSION); if (session == null) { throw new IllegalStateException("WebSocket session not found."); } if (carbonMessage instanceof TextCarbonMessage) { TextCarbonMessage textCarbonMessage = (TextCarbonMessage) carbonMessage; handleTextWebSocketMessage(textCarbonMessage, routableEndpoint, session); } else if (carbonMessage instanceof BinaryCarbonMessage) { BinaryCarbonMessage binaryCarbonMessage = (BinaryCarbonMessage) carbonMessage; handleBinaryWebSocketMessage(binaryCarbonMessage, routableEndpoint, session); } else if (carbonMessage instanceof StatusCarbonMessage) { StatusCarbonMessage statusCarbonMessage = (StatusCarbonMessage) carbonMessage; if (org.wso2.carbon.messaging.Constants.STATUS_OPEN.equals(statusCarbonMessage.getStatus())) { String connection = (String) carbonMessage.getProperty(Constants.CONNECTION); String upgrade = (String) carbonMessage.getProperty(Constants.UPGRADE); if (Constants.UPGRADE.equalsIgnoreCase(connection) && Constants.WEBSOCKET_UPGRADE.equalsIgnoreCase(upgrade)) { handleWebSocketHandshake(carbonMessage, session); } } else if (org.wso2.carbon.messaging.Constants.STATUS_CLOSE.equals(statusCarbonMessage.getStatus())) { handleCloseWebSocketMessage(statusCarbonMessage, routableEndpoint, session); } } else if (carbonMessage instanceof ControlCarbonMessage) { ControlCarbonMessage controlCarbonMessage = (ControlCarbonMessage) carbonMessage; handleControlCarbonMessage(controlCarbonMessage, routableEndpoint, session); } }