/** 关闭连接 */ public void distinct() { try { if (telnet != null && !telnet.isConnected()) telnet.disconnect(); } catch (IOException e) { e.printStackTrace(); } }
private void closeConnection() throws IOException { logger.debug("closeConnection()"); m_eventBus.post(new StateChangeEvent(this, EventType.LOST_CONNECTION)); m_TelnetState = TelnetState.DISCONNECTED; m_LoginState = LoginState.NO; m_StokerState = StokerCmdState.UNKNOWN; if (m_ReaderThread != null) m_ReaderThread.interrupt(); if (m_Telnet .isConnected()) // this is to get around a null Pointer exception in the disconnect if the // stoker is lost m_Telnet.disconnect(); }
public boolean isConnected() { return telnet.isConnected(); }