-----------------------MySocket.java-----------------
import java.net.*;
import java.io.*;
public class MySocket extends Socket implements
Serializable{
MySocket(String host, int port) throws Exception{
super(host,port);
}
}
-----------------TestSocket.java-----------------
import java.io.*;
import java.net.*;
public class TestSocket{
public static void main(String[] args){
try{
MySocket echoSocket = new MySocket("localhost",80);
FileOutputStream fout = new
FileOutputStream("name.out");
ObjectOutputStream dat = new
ObjectOutputStream(fout);
dat.writeObject(echoSocket);
}catch(Exception lvObjEx){
lvObjEx.printStackTrace();
}
}
}