Compare commits

..

No commits in common. "00b3ad3038b67676f4410d20befef5b2b6bc5b63" and "9633bf0f5d039deeee4bbd28e0136818d6b9e8ae" have entirely different histories.

16 changed files with 45 additions and 26 deletions

View file

@ -1,14 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="C:/Program Files (x86)/MySQL/Connector J 8.0/mysql-connector-java-8.0.22.jar"/>
<classpathentry kind="lib" path="C:/Program Files/tyrus-standalone-client-1.9.jar"/>
<classpathentry kind="lib" path="C:/Program Files/javax.websocket-client-api-1.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -1,2 +1,3 @@
/websocket/
/controller/
/model/
/view/

View file

@ -8,7 +8,6 @@ import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.Socket;
import java.net.URISyntaxException;
import java.net.UnknownHostException;
import java.sql.SQLException;
import java.text.DateFormat;
@ -18,7 +17,6 @@ import java.util.Calendar;
import java.util.Date;
import javax.swing.JOptionPane;
import javax.websocket.DeploymentException;
import model.Chat;
import model.LocalUser;
@ -26,7 +24,6 @@ import model.Message;
import model.Msg_Text;
import model.RemoteUser;
import view.Interface;
import websocket.Appel;
public class Controller {
@ -511,8 +508,6 @@ public class Controller {
Controller ctr = new Controller(31014,portUDPlistening_local,31024,histoire);
lstCtr.add(ctr);
Appel app=new Appel();
app.test();
/** Loop **/
Boolean running = isRunning(lstCtr);

View file

@ -16,18 +16,13 @@ public class Appel {
private Client client;
public void test() {
this.container= ContainerProvider.getWebSocketContainer();
this.client=new Client();
Session session=null;
try {
session=this.container.connectToServer(this.client, new URI ("ws://localhost:8082/WebSocket2/hello"));
Session session=this.container.connectToServer(this.client, new URI ("ws://localhost:8080/Clavardage/hello"));
} catch (DeploymentException | IOException | URISyntaxException e) {
e.printStackTrace();
System.out.println("pb avec le connect");
}
try {
this.client.onOpen(session, null);
this.client.sendMessage("hello from client");
} catch (IOException e) {
System.out.println("pb avec le sendMessage");
@ -36,4 +31,9 @@ public class Appel {
}
public void onInit(){
this.container= ContainerProvider.getWebSocketContainer();
this.client=new Client();
}
}

View file

@ -1,5 +0,0 @@
package websocket;
public class Centralized {
}

View file

@ -0,0 +1,36 @@
package websocket;
import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.websocket.ContainerProvider;
import javax.websocket.DeploymentException;
import javax.websocket.Session;
import javax.websocket.WebSocketContainer;
import org.junit.Before;
class Test {
@org.junit.jupiter.api.Test
void test() throws IOException, DeploymentException, URISyntaxException {
Session session=this.container.connectToServer(this.client, new URI ("ws://localhost:8080/Clavardage/hello"));
this.client.sendMessage("hello from client");
}
private WebSocketContainer container;
private Client client;
@Before
public void onInit(){
this.container= ContainerProvider.getWebSocketContainer();
this.client=new Client();
}
}