|
@@ -2,11 +2,14 @@ package org.robert.printer.ws;
|
|
|
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
|
|
+import org.eclipse.jetty.http.HttpVersion;
|
|
|
import org.eclipse.jetty.server.Connector;
|
|
|
import org.eclipse.jetty.server.HttpConfiguration;
|
|
|
import org.eclipse.jetty.server.HttpConnectionFactory;
|
|
|
import org.eclipse.jetty.server.Server;
|
|
|
import org.eclipse.jetty.server.ServerConnector;
|
|
|
+import org.eclipse.jetty.server.SslConnectionFactory;
|
|
|
+import org.eclipse.jetty.util.ssl.SslContextFactory;
|
|
|
import org.eclipse.jetty.websocket.server.WebSocketHandler;
|
|
|
import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;
|
|
|
|
|
@@ -63,9 +66,23 @@ public class PrintersSocketServer {
|
|
|
public void goUp() throws Exception {
|
|
|
this.server = new Server(this.getPort());
|
|
|
|
|
|
- HttpConnectionFactory httpConnectionFactory = new HttpConnectionFactory(new HttpConfiguration());
|
|
|
+ HttpConnectionFactory httpConnection = new HttpConnectionFactory(new HttpConfiguration());
|
|
|
|
|
|
- ServerConnector connector = new ServerConnector(this.server, httpConnectionFactory);
|
|
|
+
|
|
|
+ SslContextFactory sslContext = new SslContextFactory();
|
|
|
+
|
|
|
+ sslContext.setKeyStorePath(this.getClass().getResource("/resources/keystore.jks").toExternalForm());
|
|
|
+ sslContext.setKeyStorePassword("robert2206");
|
|
|
+
|
|
|
+ System.out.println("----------------------------------------------------");
|
|
|
+ System.out.println(sslContext.getKeyStoreType());
|
|
|
+ System.out.println(sslContext.isTrustAll());
|
|
|
+ System.out.println(sslContext.isValidateCerts());
|
|
|
+ System.out.println("----------------------------------------------------");
|
|
|
+
|
|
|
+ SslConnectionFactory sslConnection = new SslConnectionFactory(sslContext, HttpVersion.HTTP_1_1.asString());
|
|
|
+
|
|
|
+ ServerConnector connector = new ServerConnector(this.server, sslConnection, httpConnection);
|
|
|
connector.setHost(this.getHost());
|
|
|
connector.setPort(this.getPort() + 1);
|
|
|
|