Files
KLALB/src/org/kne/cloud/network/VirtualServerSocket.java
T
2024-08-18 17:47:11 +08:00

60 lines
1.6 KiB
Java

package org.kne.cloud.network;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketImpl;
import javax.sql.rowset.RowSetMetaDataImpl;
public abstract class VirtualServerSocket extends ServerSocket {
private VirtualSocketImpl virtualImpl;
public VirtualServerSocket(VirtualSocketImpl si) throws IOException {
super(si);
this.virtualImpl=si;
/*try {
Class<ServerSocket> c=ServerSocket.class;
Field con =c.getDeclaredField("impl");
con.setAccessible(true);
con.set(this, si);
Method m= SocketImpl.class.getDeclaredMethod("setServerSocket",ServerSocket.class);
m.setAccessible(true);
m.invoke(si, this);
} catch (SecurityException e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
} catch (NoSuchFieldException e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
} catch (NoSuchMethodException e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
} catch (InvocationTargetException e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
}*/
}
protected VirtualSocketImpl getVirtualImpl() {
return virtualImpl;
}
@Override
public abstract VirtualSocket accept() throws IOException ;
}