Package com.netflix.suro.connection

Source Code of com.netflix.suro.connection.TestSuroPing

package com.netflix.suro.connection;

import com.netflix.loadbalancer.Server;
import com.netflix.suro.SuroServer4Test;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
* @author thinker0
*/
public class TestSuroPing {

    @Test
    public void pingTest() throws Exception {
        final SuroServer4Test server4Test = new SuroServer4Test();
        server4Test.start();
        SuroPing ping = new SuroPing();
        Server server = new Server("localhost", server4Test.getPort());
        assertEquals(true, ping.isAlive(server));
        server4Test.shutdown();
    }

    @Test
    public void pingFailTest() throws Exception {
        SuroPing ping = new SuroPing();
        Server server = new Server("localhost", 7901);
        assertEquals(false, ping.isAlive(server));
    }
}
TOP

Related Classes of com.netflix.suro.connection.TestSuroPing

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.