@Test
    public void test_byteToBitSet() {
        BitSet bs = ProtocolSwitch.toBitSet(1);
        Assert.assertTrue(bs.get(0));

        bs = ProtocolSwitch.toBitSet(2);
        Assert.assertTrue(bs.get(1));

        bs = ProtocolSwitch.toBitSet(4);
        Assert.assertTrue(bs.get(2));

        bs = ProtocolSwitch.toBitSet(8);
        Assert.assertTrue(bs.get(3));

        bs = ProtocolSwitch.toBitSet(3);
        Assert.assertTrue(bs.get(0));
        Assert.assertTrue(bs.get(1));

        bs = ProtocolSwitch.toBitSet(12);
        Assert.assertTrue(bs.get(2));
        Assert.assertTrue(bs.get(3));

        bs = ProtocolSwitch.toBitSet(64);
        Assert.assertTrue(bs.get(6));

        bs = ProtocolSwitch.toBitSet(127);
        for (int i = 0; i <= 6; ++i) {
            Assert.assertTrue(bs.get(i));
        }

        Exception exception = null;
        try {
            ProtocolSwitch.toBitSet(-1);
        } catch (Exception e) {
            exception = e;
        }
        Assert.assertNotNull(exception);
        Assert.assertTrue(exception instanceof IllegalArgumentException);
    }
@author tsui
@version $Id: ProtocolSwitchStatusTest.java, v 0.1 2017-10-09 20:23 tsui Exp $
src/test/java/com/alipay/remoting/inner/utiltest/ProtocolSwitchTest.java