@@ -9,12 +9,9 @@ import me.ryun.mcsockproxy.common.IllegalConfigurationException
99
1010class ProxyServer private constructor(configuration : CraftConnectionConfiguration , path : String ) {
1111 init {
12- if (configuration.host.isNullOrEmpty())
13- throw IllegalConfigurationException (" Host is not configured." )
14- if (configuration.port == 0 )
15- throw IllegalConfigurationException (" Port is not configured." )
16- if (configuration.proxyPort == 0 )
17- throw IllegalConfigurationException (" Proxy Port is not configured." )
12+ if (configuration.host.isNullOrEmpty()) throw IllegalConfigurationException (" Host is not configured." )
13+ if (configuration.port == 0 ) throw IllegalConfigurationException (" Port is not configured." )
14+ if (configuration.proxyPort == 0 ) throw IllegalConfigurationException (" Proxy Port is not configured." )
1815
1916 val bossGroup = NioEventLoopGroup (1 )
2017 val workerGroup = NioEventLoopGroup ()
@@ -27,9 +24,12 @@ class ProxyServer private constructor(configuration: CraftConnectionConfiguratio
2724
2825 val channel = bootstrap.bind(configuration.proxyPort).sync().channel()
2926
30- println (CraftSocketConstants .PROXYING + " : " + configuration.host + " : " + configuration.port + " -> ws://localhost:${configuration.proxyPort}$path " )
27+ println (" ${ CraftSocketConstants .PROXYING } : ${ configuration.host} : ${ configuration.port} -> ws://localhost:${configuration.proxyPort}$path " )
3128
3229 channel.closeFuture().sync()
30+ } catch (cause: Throwable ) {
31+ println (" Server error: ${cause.message} " )
32+ cause.printStackTrace()
3333 } finally {
3434 workerGroup.shutdownGracefully()
3535 bossGroup.shutdownGracefully()
@@ -41,4 +41,4 @@ class ProxyServer private constructor(configuration: CraftConnectionConfiguratio
4141 return ProxyServer (configuration, path)
4242 }
4343 }
44- }
44+ }
0 commit comments