public byte[] metadata(String protocolName) {
        for (JoinGroupRequestProtocol protocol : supportedProtocols) {
            if (protocol.name().equals(protocolName)) {
                return protocol.metadata();
            }
        }

        throw new IllegalArgumentException("Member does not support protocol " +
            protocolName);
    }
@Test
    public void testMetadataRaisesOnUnsupportedProtocol() {
        ClassicGroupMember member = new ClassicGroupMember(
            "member",
            Optional.of("group-instance-id"),
            "client-id",
            "client-host",
            10,
            4500,
            "generic",
            new JoinGroupRequestProtocolCollection(),
            EMPTY_ASSIGNMENT
        );

        assertThrows(IllegalArgumentException.class, () ->
            member.metadata("unknown")
        );
    }