public final boolean tryClose(Throwable cause) {
        if (cause instanceof CancelledSubscriptionException) {
            throw new IllegalArgumentException("cause: " + cause + " (must use Subscription.cancel())");
        }
        if (setState(State.OPEN, State.CLOSED)) {
            addObjectOrEvent(new CloseEvent(cause));
            return true;
        }
        return false;
    }
Tries to close the stream with the specified {@code cause}.

@return {@code true} if the stream has been closed by this method call.
        {@code false} if the stream has been closed already by another party.
core/src/main/java/com/linecorp/armeria/common/stream/DefaultStreamMessage.java