public NetworkReceive maybeCompleteReceive() {
        if (receive != null && receive.complete()) {
            receive.payload().rewind();
            NetworkReceive result = receive;
            receive = null;
            return result;
        }
        return null;
    }
Returns the port to which this channel's socket is connected or 0 if the socket has never been connected.

If the socket was connected prior to being closed, then this method will continue to return the
connected port number after the socket is closed.
clients/src/main/java/org/apache/kafka/common/network/KafkaChannel.java