@Test
    public void testAll() {
        ServerConfig config = new ServerConfig();
        config.setProtocol("bolt")
            .setHost("127.0.0.2")
            .setPort(54321)
            .setContextPath("/")
            .setIoThreads(4)
            .setThreadPoolType("fixed")
            .setCoreThreads(20)
            .setMaxThreads(200)
            .setTelnet(false)
            .setQueueType("priority")
            .setQueues(1024)
            .setAliveTime(30000)
            .setPreStartCore(true)
            .setAccepts(30000)
            .setPayload(10 * 1024 * 1024)
            .setSerialization("protobuf")
            .setDispatcher("message")
            .setParameters(Collections.singletonMap("app", "app"))
            .setVirtualHost("192.168.1.1")
            .setVirtualPort(12345)
            .setOnConnect(Arrays.<ChannelListener> asList(new ChannelListener() {

                @Override
                public void onConnected(AbstractChannel channel) {
                }

                @Override
                public void onDisconnected(AbstractChannel channel) {
                }
            })).setEpoll(true)
            .setDaemon(false)
            .setAdaptivePort(true)
            .setTransport("netty")
            .setAutoStart(true)
            .setStopTimeout(10000)
            .setKeepAlive(true);

        Assert.assertEquals("bolt", config.getProtocol());
        Assert.assertEquals("127.0.0.2", config.getHost());
        Assert.assertEquals(54321, config.getPort());

        Assert.assertEquals("/", config.getContextPath());
        Assert.assertEquals(4, config.getIoThreads());
        Assert.assertEquals("fixed", config.getThreadPoolType());
        Assert.assertEquals(20, config.getCoreThreads());
        Assert.assertEquals(200, config.getMaxThreads());
        Assert.assertEquals(false, config.isTelnet());
        Assert.assertEquals("priority", config.getQueueType());
        Assert.assertEquals(1024, config.getQueues());
        Assert.assertEquals(30000, config.getAliveTime());

        Assert.assertEquals(true, config.isPreStartCore());
        Assert.assertEquals(30000, config.getAccepts());
        Assert.assertEquals(10 * 1024 * 1024, config.getPayload());
        Assert.assertEquals("protobuf", config.getSerialization());
        Assert.assertEquals("message", config.getDispatcher());
        Assert.assertEquals(1, config.getParameters().size());
        Assert.assertEquals("app", config.getParameters().get("app"));
        Assert.assertEquals("192.168.1.1", config.getVirtualHost());
        Assert.assertEquals(12345, (int) config.getVirtualPort());
        Assert.assertEquals(1, config.getOnConnect().size());

        Assert.assertEquals(true, config.isEpoll());
        Assert.assertEquals(false, config.isDaemon());
        Assert.assertEquals(true, config.isAdaptivePort());
        Assert.assertEquals("netty", config.getTransport());
        Assert.assertEquals(true, config.isAutoStart());
        Assert.assertEquals(10000, config.getStopTimeout());
        Assert.assertEquals(true, config.isKeepAlive());

        Assert.assertTrue(config.toString().contains("bolt"));
    }
@author <a href="mailto:zhanggeng.zg@antfin.com">GengZhang</a>
core/api/src/test/java/com/alipay/sofa/rpc/config/ServerConfigTest.java