[Demonstration 1]

[Buggy Method]
@Test
public void testGetModuleName() {
    Assert.assertEquals(authenticationContextAttributePIP.getModuleName(), "AuthenticationContextAttributePIP");
}

[Buggy Hunk]
Assert.assertEquals(authenticationContextAttributePIP.getModuleName(),

[Patch]
assertEquals(authenticationContextAttributePIP.getModuleName(),

[Demonstration 2]

[Buggy Method]
public void removeAgentConnection(ACLMessage msg) {
    AgentConnection agentconnection = null;
    if (msg.getSender().equals(gridAgent.getAgent())) {
        agentconnection = gridAgent;
    } else {
        for (AgentConnection ac : agentConnections) {
            if (ac.getAgent().equals(msg.getSender())) {
                agentconnection = ac;
            }
        }
    }
    if (agentconnection != null) {
        for (WebSocket ws : agentconnection.getClients()) {
            this.webSocketServer.sendMessage(ws, msg.getContent().toString());
            if (agentconnection != gridAgent) {
                ws.close();
            }
        }
        if (agentconnection != gridAgent) {
            agentConnections.remove(agentconnection);
        }
    }
}

[Buggy Hunk]
ws.close();

[Patch]
gridAgent.addClient(ws);

[Demonstration 3]

[Buggy Method]
@Test
public void testReconnectWarnLog() throws RemotingException, InterruptedException {
    int port = NetUtils.getAvailablePort();
    DubboAppender.doStart();
    String url = "exchange://127.0.0.2:" + port + "/client.reconnect.test?check=false&" + Constants.RECONNECT_KEY + "=" + //1ms reconnect,保证有足够频率的重连
    500 + "&reconnect.waring.period=500";
    try {
        Exchangers.connect(url);
    } catch (Exception e) {
        //do nothing
    }
    //重连线程的运行
    Thread.sleep(1500);
    //时间不够长，不会产生error日志
    Assert.assertEquals("no error message ", 0, LogUtil.findMessage(Level.ERROR, "client reconnect to "));
    //第一次重连失败就会有warn日志
    Assert.assertEquals("must have one warn message ", 1, LogUtil.findMessage(Level.WARN, "client reconnect to "));
    DubboAppender.doStop();
}

[Buggy Hunk]
+Constants.RECONNECT_KEY+"="+500 + //1ms reconnect,保证有足够频率的重连

[Patch]
+Constants.RECONNECT_KEY+"="+800 + //800ms reconnect,保证有足够频率的重连