Not-allowed(405) Connection must be encrypted

Hi,

I am using Smack 3.0.4 to login to the Gtalk. But I am getting

following message in the console.

Connected to talk.google.com

Failed to log in as null

When I enabled the debugging by doing

XMPPConnection.DEBUG_ENABLED = true;

I saw following message in the Smack Debug window:

<iq id=“G3e89-0” type=“error”><query xmlns=“jabber:iq:auth”><username>xxx@gmail.com</username></query><error code=“405” type=“CANCEL”><not-allowed xmlns=“urn:ietf:params:xml:ns:xmpp-stanzas”/><text xml:lang=“en” xmlns=“urn:ietf:params:xml:ns:xmpp-stanzas”>Connection must be encrypted.</text></error></iq>

What does this mean?

This means you must use SSL to connect to the service.

Thanks for your reply.

When I ran the same code from my home where there is no proxy I was able to login and send message to the gtalk server. Any idea how can I use smack with proxy?

You use the System Properties. I haven’t tested this though.

/** Sets system properties for proxy use */
    private void setProxy() {
        if (appSettings.useProxy()) {
            if (appSettings.proxyProtocol() == ProxyProtocols.SOCKS) {
                System.setProperty("socksProxyHost", appSettings.proxyServerName());
                System.setProperty("socksProxyPort", String.valueOf(
                        appSettings.proxyPort()));
                                if (appSettings.proxyNeedsAuth()) {
                    System.setProperty("java.net.socks.username",                             appSettings.proxyUsername());
                    System.setProperty("java.net.socks.password",                             appSettings.proxyPassword());
                }
            } else {
                System.setProperty("http.proxyHost",                         appSettings.proxyServerName());
                System.setProperty("http.proxyPort", String.valueOf(
                        appSettings.proxyPort()));
                System.setProperty("https.proxyHost",                         appSettings.proxyServerName());
                System.setProperty("https.proxyPort", String.valueOf(
                        appSettings.proxyPort()));                                if (appSettings.proxyNeedsAuth()) {
                    System.setProperty("java.net.socks.username",                             appSettings.proxyUsername());
                    System.setProperty("java.net.socks.password",                             appSettings.proxyPassword());
                }
            }
        }
    }