import java.net.*;
import java.io.*;

public class TimeURLConnection extends URLConnection {
    private Socket conn;
    public final static int DEFPORT=13;

    public TimeURLConnection(URL url) { super(url); }

    public synchronized void connect() throws IOException {
	if (!connected) {
	    int port=url.getPort();
	    if (port<=0) port=DEFPORT;
	    conn=new Socket(url.getHost(),port);
	    connected=true;
	}
    }

    public String getContentType() {
	return "text/plain";
    }

    public synchronized InputStream getInputStream() throws IOException {
	connect();
	return conn.getInputStream();
    }
}
