Hi Bernd,

Thanks for taking a look at my problem.  My keystore was created with:

keytool -genkeypair -alias certificatekey -keyalg RSA -keystore keystore.ks

and is loaded correctly. Also, I don't see this timeout when the other server is also vysper, but it always fails when connecting to another xmpp server (I've tried Prosody and Openfire).

Vysper appears to be happy with TLS:

org.apache.vysper.xmpp.server.s2s.DefaultXMPPServerConnector INFO Connecting to XMPP server remote.org.uk at remote.org.uk./x.x.x.x:31424 stanza.server DEBUG > <stream:stream xmlns="jabber:server" xmlns:db="jabber:server:dialback" xmlns:stream="http://etherx.jabber.org/streams"; from="local.co.uk" xml:lang="en_US" version="1.0" to="remote.org.uk"> stanza.client DEBUG < <stream:stream xmlns:stream="http://etherx.jabber.org/streams"; id="400a9684-2d74-496e-8e11-144161d17621" to="local.co.uk" from="remote.org.uk" version="1.0"> stanza.client DEBUG < <stream:features xmlns:stream="http://etherx.jabber.org/streams";><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"></starttls><dialback xmlns="urn:xmpp:features:dialback"><optional></optional></dialback></stream:features> org.apache.vysper.xmpp.server.s2s.FeaturesHandler INFO XMPP server connector to remote.org.uk is starting TLS stanza.server DEBUG > <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"></starttls> stanza.client DEBUG < <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"></proceed> org.apache.vysper.xmpp.server.s2s.DefaultXMPPServerConnector INFO XMPP server connector to remote.org.uk secured using TLS stanza.server DEBUG > <stream:stream xmlns="jabber:server" xmlns:db="jabber:server:dialback" xmlns:stream="http://etherx.jabber.org/streams"; from="local.co.uk" xml:lang="en_US" version="1.0" to="remote.org.uk"> stanza.client DEBUG < <stream:stream xmlns:stream="http://etherx.jabber.org/streams"; id="99566ca3-f9f6-4857-9cf4-2b29d30aae54" to="local.co.uk" from="remote.org.uk" version="1.0"> stanza.client DEBUG < <stream:features xmlns:stream="http://etherx.jabber.org/streams";><dialback xmlns="urn:xmpp:features:dialback"><optional></optional></dialback></stream:features> stanza.server DEBUG > <db:result xmlns:db="jabber:server:dialback" from="local.co.uk" to="remote.org.uk">abe64c75f3b7643a28775871019a58052a55ae56499cb4bcdfaf56fdf61937a4</db:result> stanza.client DEBUG < <stream:stream xmlns:stream="http://etherx.jabber.org/streams"; to="local.co.uk" xml:lang="en" from="remote.org.uk" version="1.0"> stanza.server DEBUG > <stream:stream xmlns="jabber:server" xmlns:db="jabber:server:dialback" xmlns:stream="http://etherx.jabber.org/streams"; from="local.co.uk" version="1.0" id="c096fd9364e34c4cb081312d4e8c1a7f"><stream:features><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"></starttls><dialback xmlns="urn:xmpp:features:dialback"></dialback></stream:features> stanza.client DEBUG < <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"></starttls> stanza.server DEBUG > <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"></proceed> stanza.client DEBUG < <stream:stream xmlns:stream="http://etherx.jabber.org/streams"; to="local.co.uk" from="remote.org.uk" version="1.0"> stanza.server DEBUG > <stream:stream xmlns="jabber:server" xmlns:db="jabber:server:dialback" xmlns:stream="http://etherx.jabber.org/streams"; from="local.co.uk" version="1.0" id="c096fd9364e34c4cb081312d4e8c1a7f"><stream:features><dialback xmlns="urn:xmpp:features:dialback"></dialback></stream:features> stanza.client DEBUG < <db:result xmlns:db="jabber:server:dialback" to="local.co.uk" from="remote.org.uk">3ebf2a672d4e3562565b4f437bd31a8b393734d83e961e58517452d78de3f93c</db:result> org.apache.vysper.xmpp.server.s2s.DefaultXMPPServerConnector WARN XMPP handshake with remote.org.uk at remote.org.uk./x.x.x.x:31424 timed out


Thanks,

Dave

On 09/06/13 14:21, Bernd Fondermann wrote:
At first, please make sure that the TLS certificate is indeed accessible.
I've seen these kind of errors when the certificate was silently not
loaded.

   Bernd

On Tue, Jun 4, 2013 at 4:15 AM, Dave <[email protected]> wrote:

Hi,

I'm trying to embed Vysper into an app which will listen for S2S
connections, replying to certain incoming stanzas and initiating business
messages to other servers.Currently, I'm failing to establish a
server-to-server connection.The remote end appears to complete the dialback
handshake, but Vysper times out after receiving the db:result stanza.

Can anyone help me with clues to what I've got wrong,or should it even
work as I'm expecting?

[detail, code and logs follow]

I've knocked up the following snippet which exhibits the behaviour I'm
seeing:

   public static void main(String... args) {
     try {
       XMPPServer server = new XMPPServer("local.co.uk");

       StorageProviderRegistry providerRegistry = new
MemoryStorageProviderRegistry(**);
       server.**setStorageProviderRegistry(**providerRegistry);

       S2SEndpoint s2sEndpoint = new S2SEndpoint();
       s2sEndpoint.setPort(31423);
       server.addEndpoint(**s2sEndpoint);

       server.setTLSCertificateInfo(**new File("keystore.ks"), "secret");
       server.start();
server.**getServerRuntimeContext().**getServerFeatures().**
setRelayingToFederationServers**(true);

       Thread.sleep(10 * 1000);

       Entity remoteServer = 
EntityImpl.parseUnchecked("rem**ote.org.uk<http://remote.org.uk>
");
       XMPPServerConnectorRegistry serverConnectorRegistry = server.**
getServerRuntimeContext().**getServerConnectorRegistry();
       XMPPServerConnector connector = serverConnectorRegistry.**
connect(remoteServer);

       System.out.println("Connected"**);
       Thread.sleep(2 * 1000);

       String messageId = VysperUtils.generateUniqueId()**;
       StanzaBuilder stanzaBuilder = StanzaBuilder.createIQStanza(**null,
remoteServer, IQStanzaType.SET, messageId);
       stanzaBuilder.addText("some random text " + messageId);
       connector.write(stanzaBuilder.**build());

     } catch (Exception e) {
       e.printStackTrace();
     }
   }

On the remote end lives an existing xmpp server, which indicates that the
remote receives the connection and sends the dialback key.

Jun 04 02:45:36 s2sin11005b0    info    Incoming s2s connection
Jun 04 02:45:36 s2sout120afe0   info    Beginning new connection attempt
to glark.co.uk (x.x.x.x:31423)
Jun 04 02:45:36 s2sout120afe0   info    sent dialback key on outgoing s2s
stream
Jun 04 02:46:06 s2sin11005b0    info    s2s disconnected: glark.co.uk->
daveball.org.uk (closed)


In the vysper logs, I can see that the dialback connection is opened, TLS
negotiation takes place, and dialback ensues.Vysper report receiving the
dial back response (actually two, one before TLS and one after), but
doesn't seem to do anything with it, and times out 30 seconds later:

Jun 04, 2013 2:45:36 AM    FINE: Processing a MESSAGE_RECEIVED for session
3
Jun 04, 2013 2:45:36 AM    FINE: Decoder writing stanza: <db:result
xmlns:db="jabber:server:**dialback" to="local.co.uk" from="remote.org.uk">
**ffdd0afd536c826324d2715fd7cc2a**8448a9c45378382c75b5289aa3d041**
f81c</db:result>
Jun 04, 2013 2:45:36 AM    FINE: < <db:result 
xmlns:db="jabber:server:**dialback"
to="local.co.uk" from="remote.org.uk">**ffdd0afd536c826324d2715fd7cc2a**
8448a9c45378382c75b5289aa3d041**f81c</db:result>
Jun 04, 2013 2:45:36 AM    FINE: Adding event MESSAGE_RECEIVED to session 3
Queue : [MESSAGE_RECEIVED, ]
Jun 04, 2013 2:45:36 AM    FINE: Firing a MESSAGE_RECEIVED event for
session 3
Jun 04, 2013 2:46:06 AM    WARNING: XMPP handshake with remote.org.uk at
() timed out
Jun 04, 2013 2:46:06 AM    WARNING: Failed connecting to XMPP server
remote.org.uk at remote.org.uk./x.x.x.x:31424


Full vysper log at: http://pastebin.com/XmLNSriP


Many thanks,
Dave


Reply via email to