NTPUDPClient ntp = new NTPUDPClient();
ntp.setDefaultTimeout( 500000 );
long currentTime = System.currentTimeMillis();
TimeInfo timeInfo = ntp.getTime( host, port );
long returnTime = timeInfo.getReturnTime();
assertTrue( Math.abs( currentTime - returnTime ) < 1000 );
timeInfo.computeDetails();
String offsetMsg = "Expected offset in range (-1000, 1000), but was " + timeInfo.getOffset();
assertTrue( offsetMsg, -1000 < timeInfo.getOffset() && timeInfo.getOffset() < 1000 );
String delayMsg = "Expected delay in range [0, 1000), but was " + timeInfo.getOffset();
assertTrue( delayMsg, 0 <= timeInfo.getDelay() && timeInfo.getDelay() < 1000 );
}