code: @SuppressWarnings("unchecked")
      // The warning 'unchecked call to write(MessageType)' being suppressed here comes from the build()
      // formally returning MessageLite-derived class that cannot be statically guaranteed to be the same MessageType
      // that is used in connectionChannel.
      protected final synchronized void closeChannel() {
          if (connectionChannel == null)
              throw new IllegalStateException("Channel is not fully initialized/has already been closed");
          connectionChannel.write(Protos.TwoWayChannelMessage.newBuilder()
                  .setType(Protos.TwoWayChannelMessage.MessageType.CLOSE)
                  .build());
          connectionChannel.closeConnection();
      }
docs: <p>Closes the channel with the client (will generate a
  {@link ServerConnectionEventHandler#channelClosed(PaymentChannelCloseException.CloseReason)} event)</p>
  
  <p>Note that this does <i>NOT</i> actually broadcast the most recent payment transaction, which will be triggered
  automatically when the channel times out by the {@link StoredPaymentChannelServerStates}, or manually by calling
  {@link StoredPaymentChannelServerStates#closeChannel(StoredServerChannel)} with the channel returned by
  {@link StoredPaymentChannelServerStates#getChannel(Sha256Hash)} with the id provided in
  {@link ServerConnectionEventHandler#channelOpen(Sha256Hash)}</p>