public SocketPipe(final Socket socket1,final Socket socket2) throws IOException {
  this.socket1=socket1;
  this.socket2=socket2;
  pipe1=new StreamPipe(socket1.getInputStream(),socket2.getOutputStream(),OUTPUT_PIPE_NAME);
  pipe2=new StreamPipe(socket2.getInputStream(),socket1.getOutputStream(),INPUT_PIPE_NAME);
  pipe1.addPipeListener(listener);
  pipe2.addPipeListener(listener);
}

public SocketPipe ( final Socket socket1 , final Socket socket2 ) throws IOException { this . socket1 = socket1 ; this . socket2 = socket2 ; pipe1 = new StreamPipe ( socket1 . getInputStream ( ) , socket2 . getOutputStream ( ) , OUTPUT_PIPE_NAME ) ; pipe2 = new StreamPipe ( socket2 . getInputStream ( ) , socket1 . getOutputStream ( ) , INPUT_PIPE_NAME ) ; pipe1 . addPipeListener ( listener ) ; pipe2 . addPipeListener ( listener ) ; }
constructs socketpipe instance by tow connected sockets .
