@@ -0,0 +1,1628 @@
+package ru.carabi.server.eventer;%0A%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.io.OutputStream;%0Aimport java.net.Socket;%0Aimport java.util.ResourceBundle;%0Aimport java.util.logging.Level;%0Aimport java.util.logging.Logger;%0A%0A/**%0A * %D0%9A%D0%BB%D0%B8%D0%B5%D0%BD%D1%82, %D0%BE%D1%82%D0%BF%D1%80%D0%B0%D0%B2%D0%BB%D1%8F%D1%8E%D1%89%D0%B8%D0%B9 %D0%B7%D0%B0%D0%BF%D1%80%D0%BE%D1%81%D1%8B %D0%B4%D0%BB%D1%8F %D0%BF%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B8 %D1%81%D0%BE%D1%81%D1%82%D0%BE%D1%8F%D0%BD%D0%B8%D1%8F Eventer-%D0%B0%0A * @author sasha%0A */%0Apublic class CheckStatus%7B%0A%09public static void main(String%5B%5D args) %7B%0A%09%09ResourceBundle settings = Main.settings;%0A%09%09int port = Integer.parseInt(settings.getString(%22LISTEN_PORT%22));%0A%09%09try (Socket socket = new Socket(%22127.0.0.1%22, port)) %7B%0A%09%09%09OutputStream outputStream = socket.getOutputStream();%0A%09%09%09InputStream inputStream = socket.getInputStream();%0A%09%09%09sendPing(outputStream);%0A%09%09%09assert %22PONG %D0%9F%D0%9E%D0%9D%D0%93%22.equals(getPongResponse(inputStream));%0A%09%09%09System.out.println(%22Eventer running%22);%0A%09%09%7D catch (Exception ex) %7B%0A%09%09%09Logger.getLogger(CheckStatus.class.getName()).log(Level.SEVERE, null, ex);%0A%09%09%09System.exit(1);%0A%09%09%7D%0A%09%7D%0A%0A%09private static void sendPing(OutputStream outputStream) throws IOException %7B%0A%09%09outputStream.write((byte)0);%0A%09%09outputStream.write((byte)CarabiMessage.Type.ping.getCode());%0A%09%09outputStream.write(%22PING %D0%9F%D0%98%D0%9D%D0%93%22.getBytes(%22UTF-8%22));%0A%09%09outputStream.write((byte)0);%0A%09%7D%0A%0A%09private static String getPongResponse(InputStream inputStream) throws IOException %7B%0A%09%09int read;%0A%09%09byte%5B%5D buffer = new byte%5B10240%5D;%0A%09%09read = inputStream.read();%0A%09%09assert read == 0;%0A%09%09read = inputStream.read();%0A%09%09assert read == CarabiMessage.Type.pong.getCode();%0A%09%09int i = 0;%0A%09%09read = inputStream.read();%0A%09%09while (read != 0) %7B%0A%09%09%09buffer%5Bi%5D = (byte) read;%0A%09%09%09read = inputStream.read();%0A%09%09%09i++;%0A%09%09%7D%0A%09%09return new String(buffer);%0A%09%7D%0A%7D%0A

check eventer status