package org.kne.cloud.network; import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; public class SSHDetectorItem implements ProtocolDetectorItem { @Override public Protocol apply(InputStream t) { try { byte[]b=new byte[3]; new DataInputStream(t).readFully(b); String s=new String(b, "ascii"); if(s.equals("SSH")) { return new Protocol("SSH"); } } catch (IOException e) { } return null; } }