ECHO.java 810 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package de.tudarmstadt.informatik.hostage.protocol;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import de.tudarmstadt.informatik.hostage.wrapper.ByteArray;
  5. /**
  6. * ECHO protocol
  7. * @author Wulf Pfeiffer
  8. */
  9. public class ECHO implements Protocol<ByteArray>{
  10. public int getPort() {
  11. return 7;
  12. }
  13. public TALK_FIRST whoTalksFirst() {
  14. return TALK_FIRST.CLIENT;
  15. }
  16. public List<ByteArray> processMessage(ByteArray message) {
  17. List<ByteArray> response = new ArrayList<ByteArray>();
  18. //respond with the received message
  19. response.add(message);
  20. return response;
  21. }
  22. public boolean isClosed() {
  23. return true;
  24. }
  25. public boolean isSecure() {
  26. return false;
  27. }
  28. public Class<ByteArray> getType() {
  29. return ByteArray.class;
  30. }
  31. public String toString() {
  32. return "ECHO";
  33. }
  34. }