in wagon-tcks/wagon-tck-http/src/main/java/org/apache/maven/wagon/tck/http/GetWagonTests.java [110:178]
public void inifiniteLatencyTimeout()
throws ConnectionException, AuthenticationException, ComponentConfigurationException, IOException,
TransferFailedException, ResourceDoesNotExistException, AuthorizationException
{
if ( !isSupported() )
{
return;
}
final ValueHolder<TransferFailedException> holder = new ValueHolder<>( null );
Runnable r = new Runnable()
{
public void run()
{
Servlet servlet = new LatencyServlet( -1 );
addNotificationTarget( servlet );
getServerFixture().addServlet( "/infinite/*", servlet );
try
{
if ( !initTest( null, null ) )
{
return;
}
if ( getWagon() instanceof StreamWagon )
{
logger.info( "Connection timeout is: " + getWagon().getTimeout() );
}
File target = newTempFile();
getWagon().get( "infinite/", target );
fail( "Should have failed to transfer due to transaction timeout." );
}
catch ( ConnectionException | AuthenticationException | ResourceDoesNotExistException
| AuthorizationException | ComponentConfigurationException | IOException e )
{
throw new IllegalStateException( e );
}
catch ( TransferFailedException e )
{
// expected
holder.setValue( e );
}
}
};
Thread t = new Thread( r );
t.start();
try
{
logger.info( "Waiting 60 seconds for wagon timeout." );
t.join( ONE_MINUTE );
}
catch ( InterruptedException e )
{
e.printStackTrace();
}
logger.info( "Interrupting thread." );
t.interrupt();
assertTrue( "TransferFailedException should have been thrown.", holder.getValue() != null );
assertWagonExceptionMessage( holder.getValue(), NO_RESPONSE_STATUS_CODE, getBaseUrl() + "infinite/",
"", null );
}