package com.jotuntech.sketcher.server.command; import java.nio.ByteBuffer; import com.jotuntech.sketcher.server.Command; import com.jotuntech.sketcher.server.Connection; import com.jotuntech.sketcher.server.Server; public class PingCommand implements Command { private long timestamp; public PingCommand() { this.timestamp = System.currentTimeMillis(); } public PingCommand(long timestamp) { this.timestamp = timestamp; } public int perform(Server server, Connection connection) { connection.setLastPing(System.currentTimeMillis()); return Connection.SEND_NONE; } public void decode(ByteBuffer in) { timestamp = in.getLong(); } public void encode(ByteBuffer out) { out.putLong(timestamp); } }