Cette révision appartient à :
LMAGallois 2021-02-13 13:29:22 +01:00
Parent 72d6f53020
révision 94031cc356
16 fichiers modifiés avec 26 ajouts et 45 suppressions

Voir le fichier

@ -1,6 +1,14 @@
<?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"/>
<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="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>

Voir le fichier

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

Fichier binaire non affiché.

Fichier binaire non affiché.

Fichier binaire non affiché.

Fichier binaire non affiché.

Fichier binaire non affiché.

Fichier binaire non affiché.

Fichier binaire non affiché.

Fichier binaire non affiché.

Fichier binaire non affiché.

Fichier binaire non affiché.

Voir le fichier

@ -8,6 +8,7 @@ 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;
@ -17,6 +18,7 @@ import java.util.Calendar;
import java.util.Date;
import javax.swing.JOptionPane;
import javax.websocket.DeploymentException;
import model.Chat;
import model.LocalUser;
@ -24,6 +26,7 @@ import model.Message;
import model.Msg_Text;
import model.RemoteUser;
import view.Interface;
import websocket.Appel;
public class Controller {
@ -508,6 +511,8 @@ 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);

Voir le fichier

@ -16,13 +16,18 @@ public class Appel {
private Client client;
public void test() {
this.container= ContainerProvider.getWebSocketContainer();
this.client=new Client();
Session session=null;
try {
Session session=this.container.connectToServer(this.client, new URI ("ws://localhost:8080/Clavardage/hello"));
session=this.container.connectToServer(this.client, new URI ("ws://localhost:8082/WebSocket2/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");
@ -31,9 +36,4 @@ public class Appel {
}
public void onInit(){
this.container= ContainerProvider.getWebSocketContainer();
this.client=new Client();
}
}

Voir le fichier

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

Voir le fichier

@ -1,36 +0,0 @@
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();
}
}