As we only have two versions here and know them anyway we could remove the Map at all and just use a simple "switch" statement to return the correct HaProxyProtocolVersion. This should be faster and remove the overhead of boxing etc.