/** * 停止服务 * * @throws Exception */ public void stop() throws Exception { receiver.stop(); sender.stop(); try { receiverThread.join(); } catch (Exception e) { e.printStackTrace(); } try { senderThread.join(); } catch (Exception e) { e.printStackTrace(); } try { antenna.socket().close(); } catch (Exception e) { } try { antenna.close(); } catch (Exception e) { } }
/** * 发送服务端消息 * * @param message * @return * @throws Exception */ public boolean send(ServerMessage message) throws Exception { return sender.send(message); }