KLALB UDP TEST
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
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();
|
||||
}*/
|
||||
}
|
||||
|
||||
public VirtualSocketImpl getVirtualImpl() {
|
||||
return virtualImpl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract VirtualSocket accept() throws IOException ;
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user