code: public static void changeAccessModelIfNecessary(LeafNode node, AccessModel accessModel)
              throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
              SmackException.NoResponseException {
          ConfigureForm current = node.getNodeConfiguration();
          if (current.getAccessModel() != accessModel) {
              ConfigureForm updateConfig = new ConfigureForm(DataForm.Type.submit);
              updateConfig.setAccessModel(accessModel);
              node.sendConfigurationForm(updateConfig);
          }
      }
docs: Query the access model of {@code node}. If it is different from {@code accessModel}, change the access model
  of the node to {@code accessModel}.
  
  @see <a href="https://xmpp.org/extensions/xep-0060.html#accessmodels">XEP-0060 §4.5 - Node Access Models</a>
  
  @param node {@link LeafNode} whose PubSub access model we want to change
  @param accessModel new access model.
  
  @throws XMPPException.XMPPErrorException in case of an XMPP protocol error.
  @throws SmackException.NotConnectedException if we are not connected.
  @throws InterruptedException if the thread is interrupted.
  @throws SmackException.NoResponseException if the server doesn't respond.