Search in sources :

Example 6 with EndPointInfo

use of org.evosuite.runtime.vnet.EndPointInfo in project evosuite by EvoSuite.

the class NetworkHandling method openRemoteTcpServer.

/**
 * Create a one-time listener on remote address/port
 * @param remoteServer
 * @return
 */
public static boolean openRemoteTcpServer(EvoSuiteRemoteAddress remoteServer) {
    if (remoteServer == null) {
        return false;
    }
    RemoteTcpServer server = new RemoteTcpServer(new EndPointInfo(remoteServer.getHost(), remoteServer.getPort(), VirtualNetwork.ConnectionType.TCP));
    VirtualNetwork.getInstance().addRemoteTcpServer(server);
    return true;
}
Also used : RemoteTcpServer(org.evosuite.runtime.vnet.RemoteTcpServer) EndPointInfo(org.evosuite.runtime.vnet.EndPointInfo)

Example 7 with EndPointInfo

use of org.evosuite.runtime.vnet.EndPointInfo in project evosuite by EvoSuite.

the class EvoSuiteSocket method doConnect.

protected synchronized void doConnect(InetAddress address, int port, int timeout) throws IOException {
    EndPointInfo remoteTarget = new EndPointInfo(address.getHostAddress(), port, ConnectionType.TCP);
    InetAddress localHost = (InetAddress) getOption(SocketOptions.SO_BINDADDR);
    EndPointInfo localOrigin = new EndPointInfo(localHost.getHostAddress(), localport, ConnectionType.TCP);
    this.openedConnection = VirtualNetwork.getInstance().connectToRemoteAddress(localOrigin, remoteTarget);
    this.setRemoteAddress(address);
    this.setRemotePort(port);
}
Also used : EndPointInfo(org.evosuite.runtime.vnet.EndPointInfo) InetAddress(java.net.InetAddress)

Aggregations

EndPointInfo (org.evosuite.runtime.vnet.EndPointInfo)7 RemoteTcpServer (org.evosuite.runtime.vnet.RemoteTcpServer)2 Test (org.junit.Test)2 DatagramPacket (java.net.DatagramPacket)1 InetAddress (java.net.InetAddress)1 Map (java.util.Map)1 Scanner (java.util.Scanner)1 EvoSuiteLocalAddress (org.evosuite.runtime.testdata.EvoSuiteLocalAddress)1 EvoSuiteRemoteAddress (org.evosuite.runtime.testdata.EvoSuiteRemoteAddress)1 ConstantPool (org.evosuite.seeding.ConstantPool)1 GenericClass (org.evosuite.utils.generic.GenericClass)1 GenericMethod (org.evosuite.utils.generic.GenericMethod)1