/*
 * Handler.java
 *
 * Created on October 10, 2001, 4:05 PM
 */

package test.protocol.sar;

import java.net.URLStreamHandler;
import java.net.URL;
import java.net.URLConnection;
import java.io.IOException;

/**
 *
 * @author  mtoma
 * @version
 */
public class Handler extends URLStreamHandler
{
    
    public URLConnection openConnection( URL url ) throws IOException
    {        
        if ( !"sar".equals(url.getProtocol()) )
        {
            throw new IOException( "Cannot create connection using " +
                                   url.getProtocol() + " protocol" );
        }
        
        return new SarURLConnection( url );
    }    
}
