private boolean processOneRequest(InputStream in,OutputStream out,Socket socket) throws IOException, InterruptedException {
  RecordedRequest request=readRequest(in,sequenceNumber);
  if (request == null) {
    return false;
  }
  MockResponse response=dispatch(request);
  writeResponse(out,response);
  if (response.getSocketPolicy() == SocketPolicy.DISCONNECT_AT_END) {
    in.close();
    out.close();
  }
 else   if (response.getSocketPolicy() == SocketPolicy.SHUTDOWN_INPUT_AT_END) {
    socket.shutdownInput();
  }
 else   if (response.getSocketPolicy() == SocketPolicy.SHUTDOWN_OUTPUT_AT_END) {
    socket.shutdownOutput();
  }
  sequenceNumber++;
  return true;
}

private boolean processOneRequest ( InputStream in , OutputStream out , Socket socket ) throws IOException , InterruptedException { RecordedRequest request = readRequest ( in , sequenceNumber ) ; if ( request == null ) { return false ; } MockResponse response = dispatch ( request ) ; writeResponse ( out , response ) ; if ( response . getSocketPolicy ( ) == SocketPolicy . DISCONNECT_AT_END ) { in . close ( ) ; out . close ( ) ; } else if ( response . getSocketPolicy ( ) == SocketPolicy . SHUTDOWN_INPUT_AT_END ) { socket . shutdownInput ( ) ; } else if ( response . getSocketPolicy ( ) == SocketPolicy . SHUTDOWN_OUTPUT_AT_END ) { socket . shutdownOutput ( ) ; } sequenceNumber ++ ; return true ; }
reads a request and writes its response . returns true if a request was processed .
