onMessage will only get called if the message received
+ * is within this returned list.
+ *
+ * @return A list of supported messages by this listener
+ */
+ public Class extends NetworkMessage>[] getSupportedMessages();
+}
diff --git a/monkey-netty/src/main/java/io/tlf/monkeynetty/client/NettyClient.java b/monkey-netty/src/main/java/io/tlf/monkeynetty/client/NettyClient.java
index 8eccc8c..ca0231b 100644
--- a/monkey-netty/src/main/java/io/tlf/monkeynetty/client/NettyClient.java
+++ b/monkey-netty/src/main/java/io/tlf/monkeynetty/client/NettyClient.java
@@ -66,22 +66,12 @@ public class NettyClient extends BaseAppState implements NetworkClient {
private final static Logger LOGGER = Logger.getLogger(NettyClient.class.getName());
- protected String service;
- protected int port;
- protected String server;
- protected boolean ssl;
- protected boolean sslSelfSigned;
protected volatile boolean reconnect = false;
protected volatile boolean disconnecting = false;
private volatile boolean udpHandshakeComplete = false;
private volatile boolean pendingEstablish = true;
- /*
- * Connection timeout in milliseconds used when client is unable connect to server
- * Note: Currently it do not apply when server is "off"
- */
- protected int connectionTimeout = 10000;
- private MessageCacheMode cacheMode = MessageCacheMode.TCP_ENABLED;
+ protected final NetworkClientSettings settings;
private LogLevel logLevel;
//Netty
@@ -95,50 +85,23 @@ public class NettyClient extends BaseAppState implements NetworkClient {
private DatagramChannel udpChannel;
private SslContext sslContext;
- private final SetMessageCacheMode.ENABLE_TCP
- * See MessageCacheMode for more information about the supported mode options.
- *
- * @param mode The desired message cache mode.
- */
- public void setMessageCacheMode(MessageCacheMode mode) {
- this.cacheMode = mode;
- }
-
- /**
- * @return The current message cache mode.
- */
- public MessageCacheMode getMessageCacheMode() {
- return cacheMode;
- }
/**
* Internal use only
@@ -224,9 +155,9 @@ public MessageCacheMode getMessageCacheMode() {
*/
private void setupTcp() {
LOGGER.fine("Setting up tcp");
- if (ssl) {
+ if (settings.isSsl()) {
try {
- if (sslSelfSigned) {
+ if (settings.isSslSelfSigned()) {
sslContext = SslContextBuilder.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE).build();
} else {
@@ -234,7 +165,7 @@ private void setupTcp() {
}
} catch (Exception ex) {
LOGGER.log(Level.WARNING, "Failed to load ssl, failing back to no ssl", ex);
- ssl = false;
+ settings.setSsl(false);
}
}
//Setup TCP
@@ -242,17 +173,17 @@ private void setupTcp() {
tcpClientBootstrap = new Bootstrap();
tcpClientBootstrap.group(tcpGroup);
tcpClientBootstrap.channel(NioSocketChannel.class);
- tcpClientBootstrap.remoteAddress(new InetSocketAddress(server, port));
+ tcpClientBootstrap.remoteAddress(new InetSocketAddress(settings.getAddress(), settings.getTcpPort()));
tcpClientBootstrap.handler(new ChannelInitializer
+ * Used as a basis for building a custom network client.
+ */
+public interface NetworkClient {
+
+ /**
+ * @return if the client is connected to the server
+ */
+ public boolean isConnected();
+
+ /**
+ * @return The settings of the client
+ */
+ public NetworkClientSettings getSettings();
+
+ /**
+ * Send a message from the client to the server
+ *
+ * @param message The message to send
+ */
+ public void send(NetworkMessage message);
+
+ /**
+ * Internal Use Only
+ * Called by the server when the server receives a message for the server side connection client.
+ *
+ * @param message The message received
+ */
+ public void receive(NetworkMessage message);
+
+ /**
+ * Disconnects the client from the server
+ */
+ public void disconnect();
+
+ /**
+ * Register a message listener with the client.
+ *
+ * @param handler The message listener to register
+ */
+ public void registerListener(ClientMessageListener handler);
+
+ /**
+ * Unregister a message listener with the client.
+ *
+ * @param handler The message listener to unregister
+ */
+ public void unregisterListener(ClientMessageListener handler);
+
+ /**
+ * Register a connection listener with the client.
+ *
+ * @param listener The connection listener to register
+ */
+ public void registerListener(ClientConnectionListener listener);
+
+ /**
+ * Unregister a connection listener with the client.
+ *
+ * @param listener The connection listener to unregister
+ */
+ public void unregisterListener(ClientConnectionListener listener);
+
+ /**
+ * Set obj value attribute for key param
+ *
+ * @param key key for attribute
+ * @param obj value object for attribute
+ */
+ public void setUserData(String key, Object obj);
+
+ /**
+ * Return attribute stored under key param
+ *
+ * @param
- * Used as a basis for building a custom network client.
+ * Used as a basis for building a custom network connection from a server.
*/
-public interface NetworkClient {
+public interface NetworkConnection {
/**
* @return if the client is connected to the server
*/
public boolean isConnected();
- /**
- * Send a message from the client to the server
- *
- * @param message The message to send
- */
- public void send(NetworkMessage message);
-
- /**
- * Internal Use Only
- * Called by the server when the server receives a message for the server side connection client.
- *
- * @param message The message received
- */
- public void receive(NetworkMessage message);
-
- /**
- * Disconnects the client from the server
- */
- public void disconnect();
-
/**
* @return If the client is connected to the server using SSL
*/
@@ -68,9 +51,14 @@ public interface NetworkClient {
public String getAddress();
/**
- * @return The port of the server the client is connecting to
+ * @return The tcp port of the server the client is connecting to
+ */
+ public int getTcpPort();
+
+ /**
+ * @return The udp port of the server the client is connecting to
*/
- public int getPort();
+ public int getUdpPort();
/**
* The service string should be unique to each server.
@@ -85,34 +73,54 @@ public interface NetworkClient {
*/
public NetworkProtocol[] getProtocol();
+ /**
+ * Send a message from the client to the server
+ *
+ * @param message The message to send
+ */
+ public void send(NetworkMessage message);
+
+ /**
+ * Internal Use Only
+ * Called by the server when the server receives a message for the server side connection client.
+ *
+ * @param message The message received
+ */
+ public void receive(NetworkMessage message);
+
+ /**
+ * Disconnects the client from the server
+ */
+ public void disconnect();
+
/**
* Register a message listener with the client.
*
* @param handler The message listener to register
*/
- public void registerListener(MessageListener handler);
+ public void registerListener(ServerMessageListener handler);
/**
* Unregister a message listener with the client.
*
* @param handler The message listener to unregister
*/
- public void unregisterListener(MessageListener handler);
+ public void unregisterListener(ServerMessageListener handler);
/**
* Register a connection listener with the client.
*
* @param listener The connection listener to register
*/
- public void registerListener(ConnectionListener listener);
+ public void registerListener(ServerConnectionListener listener);
/**
* Unregister a connection listener with the client.
*
* @param listener The connection listener to unregister
*/
- public void unregisterListener(ConnectionListener listener);
-
+ public void unregisterListener(ServerConnectionListener listener);
+
/**
* Set obj value attribute for key param
*
diff --git a/monkey-netty/src/main/java/io/tlf/monkeynetty/NetworkServer.java b/monkey-netty/src/main/java/io/tlf/monkeynetty/server/NetworkServer.java
similarity index 55%
rename from monkey-netty/src/main/java/io/tlf/monkeynetty/NetworkServer.java
rename to monkey-netty/src/main/java/io/tlf/monkeynetty/server/NetworkServer.java
index 9e718b5..c2a8ef8 100644
--- a/monkey-netty/src/main/java/io/tlf/monkeynetty/NetworkServer.java
+++ b/monkey-netty/src/main/java/io/tlf/monkeynetty/server/NetworkServer.java
@@ -22,8 +22,9 @@ of this software and associated documentation files (the "Software"), to deal
SOFTWARE.
*/
-package io.tlf.monkeynetty;
+package io.tlf.monkeynetty.server;
+import io.tlf.monkeynetty.client.NetworkClient;
import io.tlf.monkeynetty.msg.NetworkMessage;
/**
@@ -38,57 +39,12 @@ public interface NetworkServer {
*/
public int getConnections();
- /**
- * @return The port number the server is listening on
- */
- public int getPort();
-
- /**
- * @return If the server is using SSL for TCP transport
- */
- public boolean isSsl();
-
- /**
- * The service string should be unique to each server.
- * This is entirely for user use, and is not validated between server and client.
- *
- * @return The service the server is running.
- */
- public String getService();
-
- /**
- * @return Which network protocols the server supports
- */
- public NetworkProtocol[] getProtocol();
-
- /**
- * @return true if the server is currently blocking new connections
- */
- public boolean isBlocking();
/**
- * Set if the server should block incoming connections. If true
- * the server will close all incoming connections immediately without
- * performing a handshake after establishing the connection.
- *
- * @param blocking If the server should block incoming connections.
+ * @return The settings of the server
*/
- public void setBlocking(boolean blocking);
+ public NetworkServerSettings getSettings();
- /**
- * @return The maximum number of connections the server will allow.
- */
- public int getMaxConnections();
-
- /**
- * This sets the maximum number of connections the server will be allowed to have at any given time.
- * If a connection is attempted to the server and the server currently has the maximum number of
- * connections, it will immediately close the connection without performing a handshake after establishing
- * the connection.
- *
- * @param maxConnections The maximum number of connections the server will allow.
- */
- public void setMaxConnections(int maxConnections);
/**
* Send a message to all clients connected to the server.
@@ -110,26 +66,26 @@ public interface NetworkServer {
*
* @param handler The message listener to register
*/
- public void registerListener(MessageListener handler);
+ public void registerListener(ServerMessageListener handler);
/**
* Unregister a message listener with the server.
*
* @param handler The message listener to unregister
*/
- public void unregisterListener(MessageListener handler);
+ public void unregisterListener(ServerMessageListener handler);
/**
* Register a connection listener with the server.
*
* @param listener The connection listener to register
*/
- public void registerListener(ConnectionListener listener);
+ public void registerListener(ServerConnectionListener listener);
/**
* Unregister a connection listener with the server.
*
* @param listener The connection listener to unregister
*/
- public void unregisterListener(ConnectionListener listener);
+ public void unregisterListener(ServerConnectionListener listener);
}
diff --git a/monkey-netty/src/main/java/io/tlf/monkeynetty/server/NetworkServerSettings.java b/monkey-netty/src/main/java/io/tlf/monkeynetty/server/NetworkServerSettings.java
new file mode 100644
index 0000000..1fb74b5
--- /dev/null
+++ b/monkey-netty/src/main/java/io/tlf/monkeynetty/server/NetworkServerSettings.java
@@ -0,0 +1,115 @@
+package io.tlf.monkeynetty.server;
+
+import io.tlf.monkeynetty.NetworkProtocol;
+
+import java.io.File;
+
+public class NetworkServerSettings {
+
+ private String service = "monkey-netty";
+ private int tcpPort = 13900;
+ private int udpPort = 13900;
+ private boolean ssl = false;
+ private boolean sslSelfSigned = false;
+ private File sslCertFile = null;
+ private File sslKeyFile = null;
+ private int maxConnections = 10;
+ private boolean blocking = false;
+ private NetworkProtocol[] protocols = {NetworkProtocol.TCP, NetworkProtocol.UDP};
+
+ public void load(File file) {
+ //TODO
+ }
+
+ public void load(String service) {
+ //TODO
+ }
+
+ public void save() {
+ //TODO
+ }
+
+ public void save(File file) {
+ //TODO
+ }
+
+ public String getService() {
+ return service;
+ }
+
+ public void setService(String service) {
+ this.service = service;
+ }
+
+ public int getTcpPort() {
+ return tcpPort;
+ }
+
+ public void setTcpPort(int tcpPort) {
+ this.tcpPort = tcpPort;
+ }
+
+ public boolean isSsl() {
+ return ssl;
+ }
+
+ public void setSsl(boolean ssl) {
+ this.ssl = ssl;
+ }
+
+ public boolean isSslSelfSigned() {
+ return sslSelfSigned;
+ }
+
+ public void setSslSelfSigned(boolean sslSelfSigned) {
+ this.sslSelfSigned = sslSelfSigned;
+ }
+
+ public File getSslCertFile() {
+ return sslCertFile;
+ }
+
+ public void setSslCertFile(File sslCertFile) {
+ this.sslCertFile = sslCertFile;
+ }
+
+ public File getSslKeyFile() {
+ return sslKeyFile;
+ }
+
+ public void setSslKeyFile(File sslKeyFile) {
+ this.sslKeyFile = sslKeyFile;
+ }
+
+ public int getMaxConnections() {
+ return maxConnections;
+ }
+
+ public void setMaxConnections(int maxConnections) {
+ this.maxConnections = maxConnections;
+ }
+
+ public boolean isBlocking() {
+ return blocking;
+ }
+
+ public void setBlocking(boolean blocking) {
+ this.blocking = blocking;
+ }
+
+ public int getUdpPort() {
+ return udpPort;
+ }
+
+ public void setUdpPort(int udpPort) {
+ this.udpPort = udpPort;
+ }
+
+ public NetworkProtocol[] getProtocols() {
+ return protocols;
+ }
+
+ public void setProtocols(NetworkProtocol[] protocols) {
+ this.protocols = protocols;
+ }
+}
diff --git a/monkey-netty/src/main/java/io/tlf/monkeynetty/server/ServerConnectionListener.java b/monkey-netty/src/main/java/io/tlf/monkeynetty/server/ServerConnectionListener.java
new file mode 100644
index 0000000..80be30b
--- /dev/null
+++ b/monkey-netty/src/main/java/io/tlf/monkeynetty/server/ServerConnectionListener.java
@@ -0,0 +1,45 @@
+/*
+MIT License
+
+Copyright (c) 2020 Trevor Flynn
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+package io.tlf.monkeynetty.server;
+
+/**
+ * @author Trevor Flynn trevorflynn@liquidcrystalstudios.com
+ */
+public interface ServerConnectionListener {
+
+ /**
+ * Called when a client is connected
+ *
+ * @param connection The client connection to the server.
+ */
+ public void onConnect(NetworkConnection connection);
+
+ /**
+ * Called when a client disconnects
+ *
+ * @param connection The client connection to the server.
+ */
+ public void onDisconnect(NetworkConnection connection);
+}
diff --git a/monkey-netty/src/main/java/io/tlf/monkeynetty/MessageListener.java b/monkey-netty/src/main/java/io/tlf/monkeynetty/server/ServerMessageListener.java
similarity index 91%
rename from monkey-netty/src/main/java/io/tlf/monkeynetty/MessageListener.java
rename to monkey-netty/src/main/java/io/tlf/monkeynetty/server/ServerMessageListener.java
index e72d893..38f8d57 100644
--- a/monkey-netty/src/main/java/io/tlf/monkeynetty/MessageListener.java
+++ b/monkey-netty/src/main/java/io/tlf/monkeynetty/server/ServerMessageListener.java
@@ -22,14 +22,14 @@ of this software and associated documentation files (the "Software"), to deal
SOFTWARE.
*/
-package io.tlf.monkeynetty;
+package io.tlf.monkeynetty.server;
import io.tlf.monkeynetty.msg.NetworkMessage;
/**
* @author Trevor Flynn trevorflynn@liquidcrystalstudios.com
*/
-public interface MessageListener {
+public interface ServerMessageListener {
/**
* When the server/client receives a message, this will be called.
@@ -37,9 +37,9 @@ public interface MessageListener {
*
* @param msg The message received
* @param server The server that sent the message, will be null on client side application
- * @param client The client that received the message
+ * @param connection The client that received the message
*/
- public void onMessage(NetworkMessage msg, NetworkServer server, NetworkClient client);
+ public void onMessage(NetworkMessage msg, NetworkServer server, NetworkConnection connection);
/**
* The listener MessageCacheMode.ENABLE_TCP
+ * See MessageCacheMode for more information about the supported mode options.
+ *
+ * @param cacheMode The desired message cache mode.
+ */
+ public void setCacheMode(MessageCacheMode cacheMode) {
+ this.cacheMode = cacheMode;
+ }
+
+ /**
+ * @return The timeout in milliseconds for creating a new connection
+ */
+ public int getConnectionTimeout() {
+ return connectionTimeout;
+ }
+
+ /**
+ * Set the timeout duration in milliseconds for creating a new connection from the client to the server.
+ * This does not effect the read/write timeouts for messages after the connection has been established.
+ *
+ * @param connectionTimeout The timeout in milliseconds for creating a new connection.
+ */
+ public void setConnectionTimeout(int connectionTimeout) {
+ this.connectionTimeout = connectionTimeout;
+ }
+}
diff --git a/monkey-netty/src/main/java/io/tlf/monkeynetty/server/NettyConnection.java b/monkey-netty/src/main/java/io/tlf/monkeynetty/server/NettyConnection.java
index 7f91c8c..c3a6a0c 100644
--- a/monkey-netty/src/main/java/io/tlf/monkeynetty/server/NettyConnection.java
+++ b/monkey-netty/src/main/java/io/tlf/monkeynetty/server/NettyConnection.java
@@ -27,12 +27,8 @@ of this software and associated documentation files (the "Software"), to deal
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.socket.SocketChannel;
-import io.tlf.monkeynetty.ConnectionListener;
-import io.tlf.monkeynetty.NetworkClient;
-import io.tlf.monkeynetty.NetworkServer;
-import io.tlf.monkeynetty.MessageListener;
+import io.tlf.monkeynetty.*;
import io.tlf.monkeynetty.msg.NetworkMessage;
-import io.tlf.monkeynetty.NetworkProtocol;
import java.nio.channels.ClosedChannelException;
import java.util.Collections;
@@ -42,23 +38,22 @@ of this software and associated documentation files (the "Software"), to deal
import java.util.logging.Level;
import java.util.logging.Logger;
-import static io.netty.channel.ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE;
-
/**
* @author Trevor Flynn trevorflynn@liquidcrystalstudios.com
*/
-public class NettyConnection implements NetworkClient {
+public class NettyConnection implements NetworkConnection {
private final static Logger LOGGER = Logger.getLogger(NettyConnection.class.getName());
+ private final HashSetjava.util.logger Logger for Monkey-Netty.
+ * Changing the log level will not take affect if the server is running.
* @param logLevel The internal Netty.IO log level
*/
public void setLogLevel(LogLevel logLevel) {
@@ -323,18 +236,18 @@ public LogLevel getLogLevel() {
*/
private void setupTcp() {
//Setup ssl
- if (ssl) {
+ if (settings.isSsl()) {
try {
- if (selfGenCert) {
+ if (settings.isSslSelfSigned()) {
LOGGER.log(Level.WARNING, "No SSL cert or key provided, using self signed certificate");
SelfSignedCertificate ssc = new SelfSignedCertificate();
- cert = ssc.certificate();
- key = ssc.privateKey();
+ settings.setSslCertFile(ssc.certificate());
+ settings.setSslKeyFile(ssc.privateKey());
}
- sslContext = SslContextBuilder.forServer(cert, key).build();
+ sslContext = SslContextBuilder.forServer(settings.getSslCertFile(), settings.getSslKeyFile()).build();
} catch (Exception ex) {
LOGGER.log(Level.WARNING, "Failed to load ssl, failing back to no ssl", ex);
- ssl = false;
+ settings.setSsl(false);
}
}
//Setup tcp socket
@@ -375,7 +288,7 @@ public void initChannel(SocketChannel ch) {
tcpClients.remove(future.channel());
try {
- for (ConnectionListener listener : connectionListeners) {
+ for (ServerConnectionListener listener : connectionListeners) {
listener.onDisconnect(client);
}
} catch (Exception ex) {
@@ -384,13 +297,14 @@ public void initChannel(SocketChannel ch) {
});
//Setup ssl
- if (ssl) {
+ if (settings.isSsl()) {
p.addLast(sslContext.newHandler(ch.alloc()));
}
//Setup pipeline
if (logLevel != null) {
- p.addLast(new LoggingHandler(logLevel));
+ tcpLogger = new LoggingHandler(logLevel);
+ p.addLast(tcpLogger);
}
p.addLast(
new NetworkMessageEncoder(),
@@ -442,7 +356,7 @@ public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
receive(client);
}
});
- tcpFuture = tcpServer.bind(port).sync();
+ tcpFuture = tcpServer.bind(settings.getTcpPort()).sync();
} catch (Exception ex) {
LOGGER.log(Level.SEVERE, "Outside TCP server crash", ex);
}
@@ -475,7 +389,8 @@ public void initChannel(UdpChannel ch) {
//Setup pipeline
if (logLevel != null) {
- p.addLast(new LoggingHandler(logLevel));
+ udpLogger = new LoggingHandler(logLevel);
+ p.addLast(udpLogger);
}
p.addLast(
new NetworkMessageEncoder(),
@@ -524,7 +439,7 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
});
}
});
- udpFuture = udpServer.bind(port).sync();
+ udpFuture = udpServer.bind(settings.getUdpPort()).sync();
} catch (Exception ex) {
LOGGER.log(Level.SEVERE, "Outside UDP server crash", ex);
}
@@ -533,6 +448,7 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
/**
* Internal use only
* Catch a network error. This will cause the error to be sent to the logger.
+ *
* @param cause The error to catch
*/
private void catchNetworkError(Throwable cause) {
@@ -543,22 +459,22 @@ private void catchNetworkError(Throwable cause) {
}
@Override
- public void registerListener(MessageListener handler) {
+ public void registerListener(ServerMessageListener handler) {
messageListeners.add(handler);
}
@Override
- public void unregisterListener(MessageListener handler) {
+ public void unregisterListener(ServerMessageListener handler) {
messageListeners.remove(handler);
}
@Override
- public void registerListener(ConnectionListener listener) {
+ public void registerListener(ServerConnectionListener listener) {
connectionListeners.add(listener);
}
@Override
- public void unregisterListener(ConnectionListener listener) {
+ public void unregisterListener(ServerConnectionListener listener) {
connectionListeners.remove(listener);
}
diff --git a/monkey-netty/src/main/java/io/tlf/monkeynetty/NetworkClient.java b/monkey-netty/src/main/java/io/tlf/monkeynetty/server/NetworkConnection.java
similarity index 81%
rename from monkey-netty/src/main/java/io/tlf/monkeynetty/NetworkClient.java
rename to monkey-netty/src/main/java/io/tlf/monkeynetty/server/NetworkConnection.java
index bd08f13..b153c43 100644
--- a/monkey-netty/src/main/java/io/tlf/monkeynetty/NetworkClient.java
+++ b/monkey-netty/src/main/java/io/tlf/monkeynetty/server/NetworkConnection.java
@@ -21,42 +21,25 @@ of this software and associated documentation files (the "Software"), to deal
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
-package io.tlf.monkeynetty;
+package io.tlf.monkeynetty.server;
+import io.tlf.monkeynetty.NetworkProtocol;
import io.tlf.monkeynetty.msg.NetworkMessage;
+import io.tlf.monkeynetty.server.ServerConnectionListener;
+import io.tlf.monkeynetty.server.ServerMessageListener;
/**
* @author Trevor Flynn trevorflynn@liquidcrystalstudios.com
* onMessage will only get called if the message received