@@ -0,0 +1,974 @@
+import java.net.ServerSocket;%0A%0Apublic class SmartServer %7B%0A%09public static void main(String%5B%5D args) %7B%0A%09%09try %7B%0A%09%09%09ServerSocket server = new ServerSocket(6789);%0A%09%09%09while (true) %7B%0A%09%09%09%09SmartSocket client = new SmartSocket(server.accept(), new SmartSocket.SmartSocketCallback() %7B%0A%0A%09%09%09%09%09@Override%0A%09%09%09%09%09public void onNewData(SmartSocket socket, byte%5B%5D data) %7B%0A%09%09%09%09%09%09try %7B%0A%09%09%09%09%09%09%09System.out.println(%22New data: %22 + new String(data, %22UTF-8%22));%0A%09%09%09%09%09%09%7D catch (Exception e) %7B%0A%09%09%09%09%09%09%09e.printStackTrace();%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%7D%0A%0A%09%09%09%09%09@Override%0A%09%09%09%09%09public void onInitSuccess(SmartSocket socket) %7B%0A%09%09%09%09%09%09System.out.println(%22Client connected%22);%0A%09%09%09%09%09%09try %7B%0A%09%09%09%09%09%09%09socket.send(%22Hello from the server!%22.getBytes(%22UTF-8%22));%0A%09%09%09%09%09%09%7D catch (Exception e) %7B%0A%09%09%09%09%09%09%09e.printStackTrace();%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%7D%0A%0A%09%09%09%09%09@Override%0A%09%09%09%09%09public void onFail(SmartSocket socket, Exception e) %7B%0A%09%09%09%09%09%09e.printStackTrace();%0A%09%09%09%09%09%09socket.suicide();%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D);%0A%09%09%09%7D%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%7D%0A%7D%0A

Create ServerDemo.java