public void connectionClosed() {
        lock.lock();
        try {
            log.info("Server channel closed.");
            connectionOpen = false;

            try {
                if (state != null && state.getContract() != null) {
                    StoredPaymentChannelServerStates channels = (StoredPaymentChannelServerStates)
                            wallet.getExtensions().get(StoredPaymentChannelServerStates.EXTENSION_ID);
                    if (channels != null) {
                        StoredServerChannel storedServerChannel = channels.getChannel(state.getContract().getTxId());
                        if (storedServerChannel != null) {
                            storedServerChannel.clearConnectedHandler();
                        }
                    }
                }
            } catch (IllegalStateException e) {
                // Expected when we call getContract() sometimes
            }
        } finally {
            lock.unlock();
        }
    }
public void connectionClosed ( ) { lock . lock ( ) ; try { log . info ( "Server channel closed." ) ; connectionOpen = false ; try { if ( state != null && state . getContract ( ) != null ) { StoredPaymentChannelServerStates channels = ( StoredPaymentChannelServerStates ) wallet . getExtensions ( ) . get ( StoredPaymentChannelServerStates . EXTENSION_ID ) ; if ( channels != null ) { StoredServerChannel storedServerChannel = channels . getChannel ( state . getContract ( ) . getTxId ( ) ) ; if ( storedServerChannel != null ) { storedServerChannel . clearConnectedHandler ( ) ; } } } } catch ( IllegalStateException e ) { } } finally { lock . unlock ( ) ; } }
<p>Called when the connection terminates. Notifies the {@link StoredServerChannel} object that we can attempt to
resume this channel in the future and stops generating messages for the client.</p>

<p>Note that this <b>MUST</b> still be called even after either
{@link PaymentChannelServer.ServerConnection#destroyConnection(PaymentChannelCloseException.CloseReason)} or
{@link PaymentChannelServer#close()} is called to actually handle the connection close logic.</p>