001    package org.crsh.shell.impl.remoting;
002    
003    import org.crsh.shell.Shell;
004    import org.crsh.util.AbstractSocketClient;
005    
006    import java.io.IOException;
007    import java.io.InputStream;
008    import java.io.OutputStream;
009    
010    /** @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a> */
011    public class RemoteClient extends AbstractSocketClient {
012    
013      /** . */
014      private ClientAutomaton automaton;
015    
016      /** . */
017      private final Shell shell;
018    
019      public RemoteClient(int port, Shell shell) {
020        super(port);
021    
022        //
023        this.shell = shell;
024      }
025    
026      @Override
027      protected void handle(InputStream in, OutputStream out) throws IOException {
028        this.automaton = new ClientAutomaton(in, out, shell).addCloseListener(this);;
029      }
030    
031      public Runnable getRunnable() {
032        return automaton;
033      }
034    }