diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/basic/TestCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/basic/TestCommand.java index a9bcc06d..733a7757 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/basic/TestCommand.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/basic/TestCommand.java @@ -2,6 +2,7 @@ import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.command.Command; +import ru.gravit.launchserver.socket.NettyServerSocketHandler; import ru.gravit.utils.HttpDownloader; import ru.gravit.utils.helper.LogHelper; @@ -11,7 +12,7 @@ public class TestCommand extends Command { public TestCommand(LaunchServer server) { super(server); } - + NettyServerSocketHandler handler; @Override public String getArgsDescription() { return null; @@ -25,8 +26,11 @@ public String getUsageDescription() { @Override public void invoke(String... args) throws Exception { verifyArgs(args,1); - LogHelper.debug("start downloading"); - HttpDownloader downloader =new HttpDownloader(new URL(args[0]),"test.html"); - LogHelper.debug("end downloading"); + if(handler == null) + handler = new NettyServerSocketHandler(server); + if(args[0].equals("start")) + { + handler.run(); + } } } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/NettyServerSocketHandler.java b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/NettyServerSocketHandler.java index 7ce5a118..40ffac7f 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/NettyServerSocketHandler.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/NettyServerSocketHandler.java @@ -31,6 +31,7 @@ import javax.net.ssl.*; import java.io.IOException; import java.net.InetAddress; +import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; import java.nio.channels.Selector; @@ -100,7 +101,7 @@ public SSLContext SSLContextInit() throws NoSuchAlgorithmException, Unrecoverabl @Override public void run() { - SSLContext sc = null; + /*SSLContext sc = null; try { sc = SSLContextInit(); } catch (NoSuchAlgorithmException e) { @@ -115,7 +116,7 @@ public void run() { e.printStackTrace(); } catch (CertificateException e) { e.printStackTrace(); - } + }*/ //System.setProperty( "javax.net.ssl.keyStore","keystore"); //System.setProperty( "javax.net.ssl.keyStorePassword","PSP1000"); try { @@ -126,8 +127,8 @@ public void run() { e.printStackTrace(); } LogHelper.info("Starting server socket thread"); - SSLEngine engine = sc.createSSLEngine(); - engine.setUseClientMode(false); + //SSLEngine engine = sc.createSSLEngine(); + //engine.setUseClientMode(false); EventLoopGroup bossGroup = new NioEventLoopGroup(); EventLoopGroup workerGroup = new NioEventLoopGroup(); try { @@ -149,7 +150,7 @@ public void initChannel(NioSocketChannel ch) throws Exception { pipeline.addLast(new WebSocketFrameHandler()); } }); - ChannelFuture f = b.bind(server.config.getSocketAddress()).sync(); + ChannelFuture f = b.bind(new InetSocketAddress(9876)).sync(); //TEST ONLY! f.channel().closeFuture().sync(); } catch (InterruptedException e) { e.printStackTrace(); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/WebSocketFrameHandler.java b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/WebSocketFrameHandler.java index 35b77bf2..e250e18b 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/WebSocketFrameHandler.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/WebSocketFrameHandler.java @@ -15,7 +15,6 @@ public class WebSocketFrameHandler extends SimpleChannelInboundHandler