@@ -0,0 +1,1426 @@
+package org.jgroups.protocols;%0A%0Aimport java.util.logging.Logger;%0A%0Aimport org.jgroups.Global;%0Aimport org.jgroups.JChannel;%0Aimport org.jgroups.util.Util;%0Aimport org.testng.annotations.AfterMethod;%0Aimport org.testng.annotations.Test;%0A%0A/**%0A * Test for %7B@link FD_SOCK2%7D not closing its sockets within the %7B@link FD_SOCK2#stop()%7D call and subsequently failing%0A * when subsequently started again (e.g. triggered by redeploy in WildFly). Reproducible by connecting and disconnecting%0A * the channel in a loop. Typically happens on a modern machine within seconds.%0A *%0A * @author Radoslav Husar%0A * @see %3Ca href=%22https://issues.redhat.com/browse/JGRP-2647%22%3EJGRP-2647%3C/a%3E%0A */%0A@Test(groups = Global.FUNCTIONAL, singleThreaded = true)%0Apublic class FD_SOCK2_Test %7B%0A%0A    protected JChannel a;%0A%0A    public void testSocketClosing() throws Exception %7B%0A        a = new JChannel(Util.getTestStack(%0A                new FD_SOCK2().setPortRange(1).setOffset(1))%0A        ).name(%22A%22);%0A%0A        for (int i = 0; i %3C 10_000; i++) %7B%0A            try %7B%0A                a.connect(FD_SOCK2_Test.class.getSimpleName());%0A            %7D catch (Exception e) %7B%0A                Logger.getLogger(FD_SOCK2_Test.class.getSimpleName()).info(String.format(%22FD_SOCK2 socket close test failed on run #%25d%22, i));%0A                throw e;%0A            %7D%0A%0A            a.disconnect();%0A        %7D%0A    %7D%0A%0A    @AfterMethod%0A    protected void destroy() %7B%0A        Util.close(a);%0A    %7D%0A%7D%0A

Add a FD_SOCK2_Test to verify socket closure.