Test: remove usage of forbidden api (socket connect)
Original commit: elastic/x-pack-elasticsearch@5903973762c5aa76af7ce7c94eec8cdb6bf85433
@@ -20,14 +20,12 @@ import org.elasticsearch.xpack.ssl.SSLService;
import java.io.IOException;
import java.net.InetAddress;
-import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CountDownLatch;
-import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
@@ -57,7 +55,6 @@ public class SessionFactoryLoadBalancingTests extends LdapTestCase {
}
}
- @AwaitsFix(bugUrl = "https://github.com/elastic/x-pack-elasticsearch/issues/1195")
public void testRoundRobinWithFailures() throws Exception {
assumeTrue("at least one ldap server should be present for this test", ldapServers.length > 1);
logger.debug("using [{}] ldap servers, urls {}", ldapServers.length, ldapUrls());
@@ -103,13 +100,6 @@ public class SessionFactoryLoadBalancingTests extends LdapTestCase {
Runnable runnable = () -> {
try (Socket socket = new MockSocket(InetAddress.getByName("localhost"), port)) {
logger.debug("opened socket [{}] and blocking other connections", socket);
- // ensure we cannot open another socket
- IOException e = expectThrows(IOException.class, () -> {
- try (MockSocket mockSocket = new MockSocket()) {
- mockSocket.connect(new InetSocketAddress(InetAddress.getByName("localhost"), port), 500);
- }
- });
- assertThat(e.getMessage(), containsString("timed out"));
latch.countDown();
closeLatch.await();
} catch (IOException | InterruptedException e) {
@@ -126,6 +116,7 @@ public class SessionFactoryLoadBalancingTests extends LdapTestCase {
latch.await();
final int numberOfIterations = randomIntBetween(1, 5);
+ // go one iteration through and attempt a bind
for (int iteration = 0; iteration < numberOfIterations; iteration++) {
logger.debug("iteration [{}]", iteration);
for (Integer port : ports) {
