diff --git a/core/src/main/groovy/com/muwire/core/connection/Connection.groovy b/core/src/main/groovy/com/muwire/core/connection/Connection.groovy index bb927b19..95e80fc1 100644 --- a/core/src/main/groovy/com/muwire/core/connection/Connection.groovy +++ b/core/src/main/groovy/com/muwire/core/connection/Connection.groovy @@ -95,4 +95,11 @@ abstract class Connection implements Closeable { } protected abstract void write(def message); + + void sendPing() { + def ping = [:] + ping.type = "Ping" + ping.version = 1 + messages.put(ping) + } } diff --git a/core/src/main/groovy/com/muwire/core/connection/UltrapeerConnection.groovy b/core/src/main/groovy/com/muwire/core/connection/UltrapeerConnection.groovy index 9c696dc2..cc193a7a 100644 --- a/core/src/main/groovy/com/muwire/core/connection/UltrapeerConnection.groovy +++ b/core/src/main/groovy/com/muwire/core/connection/UltrapeerConnection.groovy @@ -27,8 +27,18 @@ class UltrapeerConnection extends Connection { @Override protected void write(Object message) { - // TODO Auto-generated method stub - + if (message instanceof Map) { + writeJsonMessage(message) + } else { + writeBinaryMessage(message) + } } + private void writeJsonMessage(def message) { + + } + + private void writeBinaryMessage(def message) { + + } }