vert-x3 / vertx-stomp

STOMP client/server implementation
Apache License 2.0
31 stars 28 forks source link

Cannot set droppedHandler until after a CONNECTED frame is received #27

Closed galves closed 7 years ago

galves commented 7 years ago

The outcome is that if you connect to a socket which immediately resets the connection, the error cannot be handled.

An example of this would be connecting to a socket which immediately closes the socket (e.g. due to a firewall rule).

You can simulate this with iptables like so:

-A INPUT -p tcp -m state --state NEW -m tcp --dport 61613 -j REJECT --reject-with tcp-reset

One dirty fix would be for the default droppedHandler to call resultHandler with a failed future (instead of just doing nothing), however, I think the code would benefit from a slight refactor instead.

cescoffier commented 7 years ago

I provided a fix in master where the connect method receives a failure in this case. You can also setup an exception handler on the client to collect errors.