public static Responder emptyResponder() {
    return (cap, msg) -> {
      MessageData response = null;
      switch (msg.getCode()) {
        case EthProtocolMessages.GET_BLOCK_HEADERS:
          response = BlockHeadersMessage.create(Collections.emptyList());
          break;
        case EthProtocolMessages.GET_BLOCK_BODIES:
          response = BlockBodiesMessage.create(Collections.emptyList());
          break;
        case EthProtocolMessages.GET_RECEIPTS:
          response =
              ReceiptsMessage.create(
                  Collections.emptyList(),
                  TransactionReceiptEncodingConfiguration.DEFAULT_NETWORK_CONFIGURATION);
          break;
        case EthProtocolMessages.GET_NODE_DATA:
          response = NodeDataMessage.create(Collections.emptyList());
          break;
        case EthProtocolMessages.GET_POOLED_TRANSACTIONS:
          response = PooledTransactionsMessage.create(Collections.emptyList());
          break;
      }
      return Optional.ofNullable(response);
    };
  }
Create a responder that only responds with a fixed portion of the available data.

@param portion The portion of the available data to return, from 0 to 1
ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/RespondingEthPeer.java