Buggy code:
public class URLRetrievePauseResumeTest extends ContainerAbstractTestCase { private static final String HTTP_RETRIEVE = "http:////ftp.osuosl.org//pub//eclipse//rt//ecf//org.eclipse.ecf.examples-1.0.3.v20070927-1821.zip" ; private static final String FILENAME = "foo.zip" ; private static final int PAUSE_TIME = 4000 ; private IRetrieveFileTransfer transferInstance ; private File incomingFile = null ; protected void setUp ( ) throws Exception { } protected void tearDown ( ) throws Exception { } IIncomingFileTransfer session = null ; IFileTransferPausable pausable = null ; FileOutputStream outs = null ; Object notify = new Object ( ) ; private void closeOutputStream ( ) { } protected void testReceiveHttp ( String url ) throws Exception { assertNotNull ( transferInstance ) ; final IFileTransferListener listener = new IFileTransferListener ( ) { public void handleTransferEvent ( IFileTransferEvent event ) { if ( event instanceof IIncomingFileTransferReceiveResumedEvent ) { try { IIncomingFileTransferReceiveResumedEvent rse = ( ( IIncomingFileTransferReceiveResumedEvent ) ( event ) ) ; session = rse . receive ( outs ) ; } catch ( Exception e ) { fail ( e . getLocalizedMessage ( ) ) ; } } else if ( event instanceof IIncomingFileTransferReceiveStartEvent ) { IIncomingFileTransferReceiveStartEvent rse = ( ( IIncomingFileTransferReceiveStartEvent ) ( event ) ) ; try { incomingFile = new File ( URLRetrievePauseResumeTest . FILENAME ) ; outs = new FileOutputStream ( incomingFile ) ; session = rse . receive ( outs ) ; pausable = ( ( IFileTransferPausable ) ( session . getAdapter ( IFileTransferPausable . class ) ) ) ; if ( ( pausable ) == null ) fail ( "pausable<seq2seq4repair_space>is<seq2seq4repair_space>null" ) ; } catch ( IOException e ) { fail ( e . getLocalizedMessage ( ) ) ; } } else if ( event instanceof IIncomingFileTransferReceiveDataEvent ) { System . out . println ( ( "data=" + event ) ) ; } else if ( event instanceof IIncomingFileTransferReceivePausedEvent ) { System . out . println ( ( "paused=" + event ) ) ; } else if ( event instanceof IIncomingFileTransferReceiveDoneEvent ) { closeOutputStream ( ) ; System . out . println ( ( "done=" + event ) ) ; synchronized ( notify ) { notify . notify ( ) ; } } } } ; transferInstance . sendRetrieveRequest ( FileIDFactory . getDefault ( ) . createFileID ( transferInstance . getRetrieveNamespace ( ) , url ) , listener , null ) ; if ( ( pausable ) != null ) { <START_BUG> Thread . sleep ( 1000 ) ; <END_BUG> System . out . println ( ( "pausable.pause()=" + ( pausable . pause ( ) ) ) ) ; System . out . println ( ( ( "Pausing<seq2seq4repair_space>" + ( ( URLRetrievePauseResumeTest . PAUSE_TIME ) // 1000 ) ) + "<seq2seq4repair_space>seconds" ) ) ; Thread . sleep ( URLRetrievePauseResumeTest . PAUSE_TIME ) ; final boolean success = pausable . resume ( ) ; System . out . println ( ( "pausable.resume()=" + success ) ) ; if ( ! success ) { System . out . println ( ( "session=" + ( session ) ) ) ; final Exception e = session . getException ( ) ; System . out . println ( ( "<seq2seq4repair_space>exception=" + e ) ) ; if ( e != null ) e . printStackTrace ( ) ; System . out . println ( ( "<seq2seq4repair_space>isDone=" + ( session . isDone ( ) ) ) ) ; return ; } System . out . println ( ) ; } synchronized ( notify ) { notify . wait ( ) ; } final Exception e = session . getException ( ) ; if ( e != null ) throw e ; } public void testReceiveFile ( ) throws Exception { } }

Fix:
Thread . sleep ( 500 ) ;