При попытке запуска возникает эта ошибка. Поиск в интернете ни к чему не привел.
Код Maven:
<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
org.example
WebSocket
1.0-SNAPSHOT
14
14
javax.websocket
javax.websocket-api
1.1
provided
org.glassfish.tyrus
tyrus-client
1.8.1
org.apache.maven.plugins
maven-jar-plugin
3.1.0
Starter
Код Java
import org.glassfish.tyrus.client.ClientManager;
import javax.websocket.DeploymentException;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.concurrent.CountDownLatch;
public class Starter {
public static void main(String[] args) throws DeploymentException, IOException, URISyntaxException {
CountDownLatch latch = new CountDownLatch(1);
ClientManager manager = ClientManager.createClient();
URI websocket;
websocket = new URI("
wss://localhost:8080");
manager.connectToServer(new DemoApplication(), websocket);
}
}
import javax.websocket.*;
@ClientEndpoint
public class DemoApplication {
@OnOpen
public void onOpen(Session session){
System.out.println(session.getId());
}
@OnMessage
public void onMessage(String message, Session session){
}
@OnClose
public void onClose(Session session, CloseReason reason){
}
}