@Before
    public void init() throws InterruptedException {
        concurrent = maxThread + workQueue;
        //        System.setProperty(RpcConfigs.TP_MIN_SIZE, "1");
        //        System.setProperty(RpcConfigs.TP_QUEUE_SIZE, "4");
        //        System.setProperty(RpcConfigs.TP_MAX_SIZE, "3");

        server = new BoltServer(port);
        server.start();
        server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor);
        server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor);
        server.registerUserProcessor(serverUserProcessor);

        client = new RpcClient();
        client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor);
        client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor);
        client.registerUserProcessor(clientUserProcessor);
        client.init();

        for (int i = 0; i < concurrent; i++) {
            final RequestBody bd = new RequestBody(i + 1, "Hello world!");
            Thread t = new Thread(new Runnable() {
                @Override
                public void run() {
                    Object obj = null;
                    try {
                        logger.info("client fire! =========" + bd.getId());
                        obj = client.invokeSync(addr, bd, 200);
                    } catch (InvokeTimeoutException e) {
                        Assert.assertNull(obj);
                    } catch (RemotingException e) {
                        logger.error(
                            "Other RemotingException but InvokeTimeoutException occurred in sync",
                            e);
                        Assert.fail("Should not reach here!");
                    } catch (InterruptedException e) {
                        logger.error("InterruptedException in sync", e);
                        Assert.fail("Should not reach here!");
                    }
                }

            });
            t.start();
            Thread.sleep(100);
        }
        Thread.sleep(100);
    }
@author jiangping
@version $Id: ServerBusyTest.java, v 0.1 2015-10-20 PM2:48:57 tao Exp $
src/test/java/com/alipay/remoting/rpc/exception/ServerBusyTest.java