// Path: src/main/java/com/github/phantomthief/failover/impl/checker/SimplePortChecker.java
// @Nonnull
// public static ListenableFuture<Void> asyncCheck(@Nonnull HostAndPort hostAndPort) {
//     return asyncCheck(hostAndPort.getHost(), hostAndPort.getPort());
// }
// 
// Path: src/main/java/com/github/phantomthief/failover/impl/checker/SimplePortChecker.java
// public static boolean check(String host, int port) {
//     return check(host, port, DEFAULT_CONNECTION_TIMEOUT);
// }


import static com.github.phantomthief.failover.impl.checker.SimplePortChecker.asyncCheck;
import static com.github.phantomthief.failover.impl.checker.SimplePortChecker.check;
import static java.util.concurrent.TimeUnit.NANOSECONDS;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.net.ServerSocket;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeoutException;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import com.google.common.util.concurrent.ListenableFuture;
package com.github.phantomthief.failover.impl.checker;





/**
 * @author w.vela
 * Created on 2018-06-25.
 */
class SimplePortCheckerTest {

    private ServerSocket serverSocket;
    private int port;

    @BeforeEach
    void setUp() throws IOException {
        port = ThreadLocalRandom.current().nextInt(1025, 10240);
        serverSocket = new ServerSocket(port);
    }

    @Test
    void testSync() {
// Path: src/main/java/com/github/phantomthief/failover/impl/checker/SimplePortChecker.java
// @Nonnull
// public static ListenableFuture<Void> asyncCheck(@Nonnull HostAndPort hostAndPort) {
//     return asyncCheck(hostAndPort.getHost(), hostAndPort.getPort());
// }
// 
// Path: src/main/java/com/github/phantomthief/failover/impl/checker/SimplePortChecker.java
// public static boolean check(String host, int port) {
//     return check(host, port, DEFAULT_CONNECTION_TIMEOUT);
// }


// Path: src/test/java/com/github/phantomthief/failover/impl/checker/SimplePortCheckerTest.java
import static com.github.phantomthief.failover.impl.checker.SimplePortChecker.asyncCheck;
import static com.github.phantomthief.failover.impl.checker.SimplePortChecker.check;
import static java.util.concurrent.TimeUnit.NANOSECONDS;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.net.ServerSocket;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeoutException;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import com.google.common.util.concurrent.ListenableFuture;

package com.github.phantomthief.failover.impl.checker;





/**
 * @author w.vela
 * Created on 2018-06-25.
 */
class SimplePortCheckerTest {

    private ServerSocket serverSocket;
    private int port;

    @BeforeEach
    void setUp() throws IOException {
        port = ThreadLocalRandom.current().nextInt(1025, 10240);
        serverSocket = new ServerSocket(port);
    }

    @Test
    void testSync() {
        assertTrue(check("localhost", port, 100));