package test; import java.net.UnknownHostException; import java.util.ArrayList; import org.json.JSONObject; import rsx.BomberStudentClient; import rsx.BomberStudentRequest; import rsx.tcp.TcpClient; /** * Exemple appel vers le serveur * @author Arthur Brandao */ public class ServerTest { /** * @param args the command line arguments */ public static void main(String[] args) throws InterruptedException { /* Broadcast b = new Broadcast(18426); System.out.println(b.search("i'm a bomberstudent server")); System.out.println("Resultat : " + !b.getServers().isEmpty()); //*/ /* TcpClient cli = new TcpClient("127.0.0.1", 18642); cli.connect(); cli.send("Bonjour toi le serveur comment que ça va ?"); System.out.println(cli.receive()); cli.close(); //*/ //* BomberStudentClient bsc = new BomberStudentClient(); int a = bsc.findServer(); if(a == 0){ System.err.println("Aucun serveur"); return; } bsc.addHandler("test", new ServerHandlerTest()); bsc.selectServer(0); bsc.send("POST", "aze/rty"); System.out.println("A"); Thread.sleep(15000); System.out.println("B"); JSONObject json = bsc.receive(); System.out.println(json.toString(1)); bsc.close(); //*/ } }