powered by Jive Software

NonSASLAuthentication with HTTP Proxy ->not-allowed(405) Connection must be encrypted

Hi,

I am using Smack 3.1 to login to Gtalk.

If I use my code in environment without any proxy, I can login to Gtalk.

But if I try to login to Gtalk in environment with HTTP proxy, it doesn’t work.

  1. The ProxyInfo is configured in my code.

2)Only Non-SASL Authentication is supported.

3)The connection with talk.google.com is ok.

But I have the following exception :

not-allowed(405) Connection must be encrypted.
at org.jivesoftware.smack.NonSASLAuthentication.authenticate(NonSASLAuthentication .java:82)
at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java: 358)
at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:398)
at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:349)

for the statement connection.login(username,password).

  1. Here is some traces:

The server replied with an error when an authentication packet is sended in “get” mode. The server would return the list of authentication protocols it supports, but it’s not the case.

The response sended by the server contains the key words “not-allowed(405) Connection must be encrypted.”

Here is the source code (class NonSASLAuthentication)

public String authenticate(String username, String password, String resource) throws
XMPPException {
// If we send an authentication packet in “get” mode with just the username,
// the server will return the list of authentication protocols it supports.
Authentication discoveryAuth = new Authentication();
discoveryAuth.setType(IQ.Type.GET);
discoveryAuth.setUsername(username);

PacketCollector collector =
connection.createPacketCollector(new PacketIDFilter(discoveryAuth.getPacketID()));
// Send the packet
connection.sendPacket(discoveryAuth);
// Wait up to a certain number of seconds for a response from the server.
IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
System.out.println(“NonSASLAuthentification - response =” + response.toXML());
if (response == null) {
throw new XMPPException(“No response from the server.”);
}
// If the server replied with an error, throw an exception.
else if (response.getType() == IQ.Type.ERROR) {
throw new XMPPException(response.getError());
}

Has anybody heard about similar problem? any suggestions?

Thanks in advance.