so, it is possible (though extremely unlikely given that the class is not supposed to be threadsafe) that between the compareAndSet(null, client) in 166 (which indicates that another client has been created and opened) and the clientHolder.get() in 168, another thread encounters an error and does internalClose() which sets the holder to null.

Thinking about this; given that the class is not supposed to be threadsafe, it is probably overkill.