code: private void checkTopicSubscribePermission(String topic) {
          SecurityManager sm = System.getSecurityManager();
          if (sm == null)
              return;
  
          sm.checkPermission(new TopicPermission(topic, SUBSCRIBE));
      }
docs: Check if the caller has permission to subscribe to events published to
  the specified topic.
  
  @param topic
  the topic being subscribed to