Auto detect protocol