void accept(int timeout) throws IOException {
  try {
    startThreads();
    PseudoTcpState state=pseudoTcp.getState();
    if (state == PseudoTcpState.TCP_CLOSED) {
      throw new IOException("Socket closed");
    }
    if (pseudoTcp.getState() != PseudoTcpState.TCP_ESTABLISHED) {
synchronized (state_notify) {
        state_notify.wait(timeout);
      }
    }
    if (pseudoTcp.getState() != PseudoTcpState.TCP_ESTABLISHED) {
      throw new IOException("Accept timeout");
    }
  }
 catch (  InterruptedException ex) {
    IOException e=new IOException("Accept aborted");
    pseudoTcp.closedown(e);
    throw e;
  }
}

void accept ( int timeout ) throws IOException { try { startThreads ( ) ; PseudoTcpState state = pseudoTcp . getState ( ) ; if ( state == PseudoTcpState . TCP_CLOSED ) { throw new IOException ( "Socket closed" ) ; } if ( pseudoTcp . getState ( ) != PseudoTcpState . TCP_ESTABLISHED ) { synchronized ( state_notify ) { state_notify . wait ( timeout ) ; } } if ( pseudoTcp . getState ( ) != PseudoTcpState . TCP_ESTABLISHED ) { throw new IOException ( "Accept timeout" ) ; } } catch ( InterruptedException ex ) { IOException e = new IOException ( "Accept aborted" ) ; pseudoTcp . closedown ( e ) ; throw e ; } }
blocking method waits for connection .
