How to close and reopen a dead incoming TCP connection at openHAB side?

Hello *,

I have a sample TCP connection running.

A TCP client starts a connection to openHAB server, refreshes the state every 10 seconds, everything is fine. In case of an openHAB shutdown the client reconnects to openHAB.

But if I am stopping the client (and openHAB is up) then openHAB does not close the dead incoming connection. If the client tries to reopen the connection then openHAB reports

[t.AbstractSocketChannelBinding] - Disconnecting the unallowed remote end /xxx.xxx.xxx.xxx:xxxx

If I am right following happens: In the source code

…github.com/openhab/openhab/blob/master/bundles/binding/org.openhab.binding.tcp/src/main/java/org/openhab/binding/tcp/AbstractSocketChannelBinding.java

there is a check for existing connections:

line 1408: if (firstChannel != null) {

and this channel is not closed.

Does somebody have an idea how to close an dead incoming TCP connection? E.g. with help of an timeout?

If I am closing the connection from client side (by connection.close() operation) then openHAB detects this and a reconnect is possible. But in case of broken WLAN etc. reconnect is not possible.

Thank you for your support!

Sven