byte[] ip_bytes = (byte[])reply.get( "ip_address" );
if ( ip_bytes == null ){
throw( new NetworkAdminException( "IP address missing in reply" ));
}
byte[] reason = (byte[])reply.get( "reason" );
if ( reason != null ) {
throw( new NetworkAdminException( new String( reason, "UTF8")));
}
return( InetAddress.getByAddress( ip_bytes ));
}catch( Throwable e){
last_error = e;
timeout += timeout_inc;
}
}
if ( last_error != null ){
throw( last_error );
}
throw( new NetworkAdminException( "Timeout" ));
}finally{
try{
data_to_send.put( "seq", new Long(99));
long connection_id = 0x8000000000000000L | random.nextLong();
NetworkAdminNATUDPRequest request_packet = new NetworkAdminNATUDPRequest( connection_id );
request_packet.setPayload( data_to_send );
// fire off one last packet in attempt to inform server of completion
listener.reportProgress( "Sending completion event" );
packet_handler.send( request_packet, new InetSocketAddress( UDP_SERVER_ADDRESS, UDP_SERVER_PORT ));
}catch( Throwable e){
}
}
}catch( NetworkAdminException e ){
throw( e );
}catch( Throwable e ){
throw( new NetworkAdminException( "Inbound test failed", e ));
}finally{
packet_handler.setExplicitBindAddress( null );