Smack 4.1.2 Proxy problem on Android

Hello!

I’m using Smack 4.1.2 on Android (buildToolsVersion “22.0.1”) and get error using proxy:

W/System.err﹕ java.net.SocketException: Unconnected sockets not implemented

W/System.err﹕ at javax.net.SocketFactory.createSocket(SocketFactory.java:64)

W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectUsingConfiguration(XMPPTCPC onnection.java:560)

W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection. java:830)

W/System.err﹕ at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.ja va:365)

As I understood, it caused by javax.net.SocketFactory

public Socket createSocket() throws IOException {
   // follow RI's behavior
   throw new SocketException("Unconnected sockets not implemented");
}

No one of Smack implementations of SocketFactory (e.g. org.jivesoftware.smack.proxy.DirectSocketFactory) do not override this method.

And XMPPTCPConnection.connectUsingConfiguration calls SocketFactory.createSocket().

Logged as SMACK-683. Thanks for reporting.

Note that this is not Android specific.

Here is my proposed fix Rework Proxy API · Flowdalic/Smack@7032688 · GitHub for Smack 4.2

@Grigory Fedorov were you able to get it working.

If yes, Can you please share your nginx config with smack code for connection.

Thanks