/** * Calculates the connectionState resulting from the message in the current connection state. * Checks if the specified message is allowed in the connection's state and throws an exception if * not. * * @param con * @param msg * @return * @throws won.protocol.exception.IllegalMessageForConnectionStateException if the message is not * allowed in the connection's current state */ private ConnectionState performStateTransit(Connection con, ConnectionEventType msg) throws IllegalMessageForConnectionStateException { if (!msg.isMessageAllowed(con.getState())) { throw new IllegalMessageForConnectionStateException( con.getConnectionURI(), msg.name(), con.getState()); } return con.getState().transit(msg); }