Examples of HostAddress


Examples of org.apache.directory.shared.kerberos.components.HostAddress

                throw new KerberosException( ErrorType.KRB_AP_ERR_BADMATCH );
            }
   
            if ( ticket.getEncTicketPart().getClientAddresses() != null )
            {
                if ( !ticket.getEncTicketPart().getClientAddresses().contains( new HostAddress( clientAddress ) ) )
                {
                    throw new KerberosException( ErrorType.KRB_AP_ERR_BADADDR );
                }
            }
            else
View Full Code Here

Examples of org.apache.directory.shared.kerberos.components.HostAddress

            if ( clientOptions.getClientAddresses() != null )
            {
                HostAddresses addresses = new HostAddresses();
                for ( InetAddress ia : clientOptions.getClientAddresses() )
                {
                    addresses.addHostAddress( new HostAddress( ia ) );
                }

                reqBody.setAddresses( addresses );
            }
View Full Code Here

Examples of org.apache.mailet.HostAddress

            MessagingException lastError = null;

            while ( targetServers.hasNext()) {
                try {
                    HostAddress outgoingMailServer = (HostAddress) targetServers.next();
                    StringBuffer logMessageBuffer =
                        new StringBuffer(256)
                        .append("Attempting delivery of ")
                        .append(mail.getName())
                        .append(" to host ")
                        .append(outgoingMailServer.getHostName())
                        .append(" at ")
                        .append(outgoingMailServer.getHost())
                        .append(" for addresses ")
                        .append(Arrays.asList(addr));
                    log(logMessageBuffer.toString());

                    Properties props = session.getProperties();
                    if (mail.getSender() == null) {
                        props.put("mail.smtp.from", "<>");
                    } else {
                        String sender = mail.getSender().toString();
                        props.put("mail.smtp.from", sender);
                    }

                    //Many of these properties are only in later JavaMail versions
                    //"mail.smtp.ehlo"  //default true
                    //"mail.smtp.auth"  //default false
                    //"mail.smtp.dsn.ret"  //default to nothing... appended as RET= after MAIL FROM line.
                    //"mail.smtp.dsn.notify" //default to nothing...appended as NOTIFY= after RCPT TO line.

                    Transport transport = null;
                    try {
                        transport = session.getTransport(outgoingMailServer);
                        try {
                            if (authUser != null) {
                                transport.connect(outgoingMailServer.getHostName(), authUser, authPass);
                            } else {
                                transport.connect();
                            }
                        } catch (MessagingException me) {
                            // Any error on connect should cause the mailet to attempt
                            // to connect to the next SMTP server associated with this
                            // MX record.  Just log the exception.  We'll worry about
                            // failing the message at the end of the loop.
                            log(me.getMessage());
                            continue;
                        }
                        // if the transport is a SMTPTransport (from sun) some
                        // performance enhancement can be done.
                        if (transport instanceof SMTPTransport)  {
                            SMTPTransport smtpTransport = (SMTPTransport) transport;
                          
                            // if the message is alredy 8bit or binary and the
                            // server doesn't support the 8bit extension it has
                            // to be converted to 7bit. Javamail api doesn't perform
                            // that conversion, but it is required to be a
                            // rfc-compliant smtp server.
                           
                            // Temporarily disabled. See JAMES-638
                            /*
                            if (!smtpTransport.supportsExtension("8BITMIME")) {
                                try {
                                    convertTo7Bit(message);
                                } catch (IOException e) {
                                    // An error has occured during the 7bit conversion.
                                    // The error is logged and the message is sent anyway.
                                   
                                    log("Error during the conversion to 7 bit.", e);
                                }
                            }
                            */
                           
                            /*
                             * Workaround for a javamail 1.3.2 bug: if
                             * a message is sent without encoding information
                             * and the 8bit allow property is set an exception
                             * is trown during the mail delivery.
                             */
                           
                            try {
                                setEncodingIfMissing(message);
                            } catch (IOException e) {
                                log("Error while adding encoding information to the message", e);
                            }
                        } else {
                            // If the transport is not the one
                            // developed by Sun we are not sure of how it
                            // handles the 8 bit mime stuff,
                            // so I convert the message to 7bit.
                            try {
                                convertTo7Bit(message);
                            } catch (IOException e) {
                                log("Error during the conversion to 7 bit.", e);
                            }
                        }
                        transport.sendMessage(message, addr);
                    } finally {
                        if (transport != null) {
                            try
                            {
                              // James-899: transport.close() sends QUIT to the server; if that fails
                              // (e.g. because the server has already closed the connection) the message
                              // should be considered to be delivered because the error happened outside
                              // of the mail transaction (MAIL, RCPT, DATA).
                              transport.close();
                            }
                            catch (MessagingException e)
                            {
                              log("Warning: could not close the SMTP transport after sending mail (" + mail.getName()
                                  + ") to " + outgoingMailServer.getHostName() + " at " + outgoingMailServer.getHost()
                                  + " for " + mail.getRecipients() + "; probably the server has already closed the "
                                  + "connection. Message is considered to be delivered. Exception: " + e.getMessage());
                            }
                            transport = null;
                        }
                    }
                    logMessageBuffer =
                                      new StringBuffer(256)
                                      .append("Mail (")
                                      .append(mail.getName())
                                      .append(") sent successfully to ")
                                      .append(outgoingMailServer.getHostName())
                                      .append(" at ")
                                      .append(outgoingMailServer.getHost())
                                      .append(" for ")
                                      .append(mail.getRecipients());
                    log(logMessageBuffer.toString());
                    return true;
                } catch (SendFailedException sfe) {
View Full Code Here

Examples of org.jivesoftware.smack.util.dns.HostAddress

        Iterator<HostAddress> it = config.getHostAddresses().iterator();
        List<HostAddress> failedAddresses = new LinkedList<HostAddress>();
        boolean xmppIOError = false;
        while (it.hasNext()) {
            exception = null;
            HostAddress hostAddress = it.next();
            String host = hostAddress.getFQDN();
            int port = hostAddress.getPort();
            try {
                if (config.getSocketFactory() == null) {
                    this.socket = new Socket(host, port);
                }
                else {
                    this.socket = config.getSocketFactory().createSocket(host, port);
                }
            } catch (UnknownHostException uhe) {
                String errorMessage = "Could not connect to " + host + ":" + port + ".";
                exception = new XMPPException(errorMessage, new XMPPError(XMPPError.Condition.remote_server_timeout,
                        errorMessage), uhe);
            } catch (IOException ioe) {
                String errorMessage = "XMPPError connecting to " + host + ":" + port + ".";
                exception = new XMPPException(errorMessage, new XMPPError(XMPPError.Condition.remote_server_error,
                        errorMessage), ioe);
                xmppIOError = true;
            }
            if (exception == null) {
                // We found a host to connect to, break here
                config.setUsedHostAddress(hostAddress);
                break;
            }
            hostAddress.setException(exception);
            failedAddresses.add(hostAddress);
            if (!it.hasNext()) {
                // There are no more host addresses to try
                // throw an exception and report all tried
                // HostAddresses in the exception
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.