@Override
    public final byte[] getChannelId() throws SSLException {
        if (getUseClientMode()) {
            throw new IllegalStateException("Client mode");
        }

        synchronized (ssl) {
            if (state != STATE_READY) {
                throw new IllegalStateException(
                        "Channel ID is only available after handshake completes");
            }
        }
        return ssl.getTlsChannelId();
    }
Gets the TLS Channel ID for this server socket. Channel ID is only available once the
handshake completes.

@return channel ID or {@code null} if not available.

@throws IllegalStateException if this is a client socket or if the handshake has not yet
        completed.
@throws SSLException if channel ID is available but could not be obtained.
common/src/main/java/org/conscrypt/ConscryptFileDescriptorSocket.java