Send TCP command and await response

Hi again,

While it needs a lot of cleanup, I've got a lot of it working and just had some follow-up questions.

Firstly, I'm wondering about the best way of opening a persistent TCP connection so I can call writeAndFlush on the same channel from separate functions. I tried a number of things, but if I terminate the connection at the server end and then try to reconnect, it leads to a Fatal error: leaking promise.
I think I've answered this one for myself. See edit below.

This leads me to my second question, which is how best to use the fireChannelInactive method to trigger a reconnection automatically? I think I found one solution on Stack Overflow written by you @lukasa, but I couldn't quite get it working.

Finally, how does one go about accessing an instance of a client from other views? Can it be done the same way as passing instances of other classes with EnvironmentObjects?

It's a lot to answer, but if you could help me with even one question, I'd be extremely grateful.

Edit: Looking through the Netty documentation, I found that a channel can't be reopened once Channel.getCloseFuture() is called. I think this answers my first question, and that instead of trying to reuse the original channel, a new channel should be created.