@Override public void handle(GetIpResponse event) { InetAddress ip = null; int clientPort = 54644; int serverPort = 54645; try { ip = InetAddress.getLocalHost(); } catch (UnknownHostException ex) { logger.error("UnknownHostException"); fail(); } Address cAddr = new Address(ip, clientPort, 0); Address sAddr = new Address(ip, serverPort, 1); logger.info("Server: " + cAddr); logger.info("Client: " + cAddr); clientAddr = new VodAddress(cAddr, VodConfig.SYSTEM_OVERLAY_ID); serverAddr = new VodAddress(sAddr, VodConfig.SYSTEM_OVERLAY_ID); nodeDesc = new VodDescriptor(clientAddr, utility, 0, BaseCommandLineConfig.DEFAULT_MTU); nodes = new ArrayList<VodDescriptor>(); nodes.add(nodeDesc); PortBindRequest requestServer = new PortBindRequest(serverAddr.getPeerAddress(), Transport.TCP); requestServer.setResponse(new PortBindResponse(requestServer) {}); trigger(requestServer, server.getPositive(NatNetworkControl.class)); }
@Override public void handle(TConnectionMsg.Pong event) { logger.info("Received pong"); CloseConnectionRequest request = new CloseConnectionRequest(0, serverAddr.getPeerAddress(), Transport.TCP); request.setResponse(new CloseConnectionResponse(request)); trigger(request, client.getPositive(NatNetworkControl.class)); }