server: add a HELLO handshake
[fanfix.git] / src / be / nikiroo / utils / serial / server / ServerBridge.java
index cb06f56369054deb8ab06b6a1e201c7ac1611e62..25d451c51577cb581c05c1daf14e702aec99b86b 100644 (file)
@@ -198,6 +198,13 @@ public class ServerBridge extends Server {
                trace("<<< SERVER", data);
        }
 
+       @Override
+       protected ConnectActionClient getConnectionToMe()
+                       throws UnknownHostException, IOException {
+               return new ConnectActionClientString(new Socket((String) null,
+                               getPort()), key);
+       }
+
        @Override
        public void run() {
                getTraceHandler().trace(
@@ -227,14 +234,14 @@ public class ServerBridge extends Server {
                        try {
                                while (data.startsWith("ZIP:") || data.startsWith("B64:")) {
                                        if (data.startsWith("ZIP:")) {
-                                               data = StringUtils.unbase64s(data.substring(4), true);
+                                               data = StringUtils.unzip64s(data.substring(4));
                                        } else if (data.startsWith("B64:")) {
-                                               data = StringUtils.unbase64s(data.substring(4), false);
+                                               data = StringUtils.unzip64s(data.substring(4));
                                        }
                                }
 
                                InputStream stream = new ByteArrayInputStream(
-                                               data.getBytes("UTF-8"));
+                                               StringUtils.getBytes(data));
                                try {
                                        Object obj = new Importer().read(stream).getValue();
                                        if (obj == null) {