Created
April 20, 2017 17:39
-
-
Save wnds/5498ff21c42bfb1368c40a198076f9fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.vivek.j2ee.websockets.server; | |
import org.glassfish.tyrus.server.Server; | |
import javax.websocket.DeploymentException; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
public class WebSocketServerWrapper { | |
public static void main(String args[]) { | |
runServer(); | |
} | |
private static void runServer() { | |
Server server = new Server("localhost", 8025, "/websocket", EchoWebSocketEndPoint.class); | |
try { | |
server.start(); | |
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); | |
System.out.print("Please press a key to stop the server."); | |
reader.readLine(); | |
} catch (DeploymentException | IOException e) { | |
e.printStackTrace(); | |
} finally { | |
server.stop(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment