public ProtocolMessage demultiplex(final MessageData receivedMessage) {
    final Map.Entry<Range<Integer>, Capability> agreedCap =
        agreedCaps.getEntry(receivedMessage.getCode());

    if (agreedCap == null) {
      return new ProtocolMessage(null, receivedMessage);
    }

    final int offset = -agreedCap.getKey().lowerEndpoint();
    final Capability cap = agreedCap.getValue();

    final MessageData demultiplexedMessage = offsetMessageCode(receivedMessage, offset);
    return new ProtocolMessage(cap, demultiplexedMessage);
  }
Given a message from a peer, determine which capability the message corresponds to and maps the
message code to the appropriate value.

@param receivedMessage The message received from a peer.
@return The interpreted message.
ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/rlpx/wire/CapabilityMultiplexer.java