code: private LDAPConnection createLDAPConnection() throws GuacamoleException {
  
          // Map encryption method to proper connection and socket factory
          EncryptionMethod encryptionMethod = confService.getEncryptionMethod();
          switch (encryptionMethod) {
  
              // Unencrypted LDAP connection
              case NONE:
                  logger.debug("Connection to LDAP server without encryption.");
                  return new LDAPConnection();
  
              // LDAP over SSL (LDAPS)
              case SSL:
                  logger.debug("Connecting to LDAP server using SSL/TLS.");
                  return new LDAPConnection(new LDAPJSSESecureSocketFactory());
  
              // LDAP + STARTTLS
              case STARTTLS:
                  logger.debug("Connecting to LDAP server using STARTTLS.");
                  return new LDAPConnection(new LDAPJSSEStartTLSFactory());
  
              // The encryption method, though known, is not actually
              // implemented. If encountered, this would be a bug.
              default:
                  throw new GuacamoleUnsupportedException("Unimplemented encryption method: " + encryptionMethod);
  
          }
  
      }
docs: Creates a new instance of LDAPConnection, configured as required to use
  whichever encryption method is requested within guacamole.properties.
  
  @return
  A new LDAPConnection instance which has already been configured to
  use the encryption method requested within guacamole.properties.
  
  @throws GuacamoleException
  If an error occurs while parsing guacamole.properties, or if the
  requested encryption method is actually not implemented (a bug).