static Map<String, String> buildClientVersionHeader(String clientVersion, boolean required) {
        if (clientVersion == null || clientVersion.equals("")) {
            return Collections.emptyMap();
        }

        if (required) {
            return Collections.singletonMap(INFURA_ETHEREUM_PREFERRED_CLIENT, clientVersion);
        } else {
            return Collections.singletonMap(
                    INFURA_ETHEREUM_PREFERRED_CLIENT, clientVersion + "; required=false");
        }
    }
@Test
    public void testBuildHeader() {
        assertTrue(buildClientVersionHeader("", false).isEmpty());
        assertTrue(buildClientVersionHeader(null, false).isEmpty());

        assertEquals(
                buildClientVersionHeader("geth 1.4.19", true),
                (Collections.singletonMap("Infura-Ethereum-Preferred-Client", "geth 1.4.19")));

        assertEquals(
                buildClientVersionHeader("geth 1.4.19", false),
                (Collections.singletonMap(
                        "Infura-Ethereum-Preferred-Client", "geth 1.4.19; required=false")));
    }