package org.kne.cloud.network.nathole;

import java.io.IOException;
import java.net.BindException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketOption;
import java.net.SocketOptions;
import java.nio.channels.SocketChannel;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class NatholeTestC {
	public static ExecutorService exc=Executors.newCachedThreadPool();
	public static void main(String[] args) throws IOException {
		for (int i1 = 1024; i1 < 65536; i1++) {
			int i2=i1;
			exc.execute(()->{
				try {
				Socket s=new Socket();
				System.out.println(i2);
				s.bind(new InetSocketAddress("0.0.0.0", i2));
					s.connect(new InetSocketAddress("10.235.16.1", 10400), 100);
				System.out.println("成功！");
				System.exit(0);
				} catch (IOException e) {
				}
			});
		}
	}
}
