package org.kne.cloud.network.nathole;

import java.io.IOException;
import java.net.BindException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.nio.channels.SocketChannel;

public class NatholeTestS {
	public static void main(String[] args) throws IOException {
		for (int i1 = 1024; i1 < 32768; i1++) {
			try {
			SocketChannel sc=	SocketChannel.open();
		sc.configureBlocking(false)	;
		sc.bind(new InetSocketAddress("0.0.0.0", i1));
		sc.connect(new InetSocketAddress("183.199.49.116",21000));
		sc.close();
		int i2=i1;
		new Thread(()->{
			try {
				ServerSocket ssk=new ServerSocket(i2);
				while(true) {
					Socket s=ssk.accept();
					System.out.println(s);
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
		} ).start();
			System.out.println(i1);
			}catch(BindException e) {
			}
		}
	}
}
