The SecureSocketImpl has problem with order/meaning of reset/close/shutdown methods.
If one calls close() twice then shutdown will fail with error because one will try to "shutdown" already shutted down/closed socket.
This is because close() shut's down socket and destructor also calls close() (indirectly via reset) without any condition.
Refectoring is needed or shutdown shall check if shutdown is already sent (this is a patch contents).
It might be also feasible for shutdown to check if socket is not closed already ...
or reset() shall not close closed socket ...
Many alternatives possible.