@Override protected void doReadMessage(InputStream in, int size) throws I2CPMessageException, IOException { SessionId id = new SessionId(); try { id.readBytes(in); } catch (DataFormatException dfe) { throw new I2CPMessageException("Unable to load the message data", dfe); } setSessionId(id); }
/** * Send messages to the router destroying the session and disconnecting * */ public void disconnect(I2PSessionImpl session) throws I2PSessionException { if (session.isClosed()) return; DestroySessionMessage dmsg = new DestroySessionMessage(); dmsg.setSessionId(session.getSessionId()); session.sendMessage_unchecked(dmsg); // use DisconnectMessage only if we fail and drop connection... // todo: update the code to fire off DisconnectMessage on socket error //DisconnectMessage msg = new DisconnectMessage(); //msg.setReason("Destroy called"); //session.sendMessage(msg); }
public DataStructure createDataStructure() throws DataFormatException { DestroySessionMessage msg = new DestroySessionMessage(); msg.setSessionId((SessionId)(new SessionIdTest()).createDataStructure()); return msg; } public DataStructure createStructureToRead() { return new DestroySessionMessage(); }