code: public Form getRegistrationForm() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
          Registration reg = new Registration();
          reg.setType(IQ.Type.get);
          reg.setTo(room);
  
          IQ result = connection.createStanzaCollectorAndSend(reg).nextResultOrThrow();
          return Form.getFormFrom(result);
      }
docs: Returns the room's registration form that an unaffiliated user, can use to become a member
  of the room or <tt>null</tt> if no registration is possible. Some rooms may restrict the
  privilege to register members and allow only room admins to add new members.<p>
  
  If the user requesting registration requirements is not allowed to register with the room
  (e.g. because that privilege has been restricted), the room will return a "Not Allowed"
  error to the user (error code 405).
  
  @return the registration Form that contains the fields to complete together with the
  instrucions or <tt>null</tt> if no registration is possible.
  @throws XMPPErrorException if an error occurs asking the registration form for the room or a
  405 error if the user is not allowed to register with the room.
  @throws NoResponseException if there was no response from the server.
  @throws NotConnectedException
  @throws InterruptedException