I need to make the program to occupy only one port, I did this with the help of flags: -Djava.security.manager -Djava.security.policy=server.policy and in the server.policy file server.policy wrote:
grant { permission java.net.SocketPermission "127.0.0.1:2565", "connect,accept,resolve"; }; But the problem is that such a solution blocks access to everything, and only this works. The option to just write everything that the program requires is simply unreal. Considering that this program (server) has the ability to add plug-ins, that is, either in the file just somehow, somewhere to find a list of everything and add there, or it is possible to resolve everything by type, but limit java.net.SocketPermission. Well, you can allow everything to java.security.AllPermission, and here's how to restrict something, without a clue.
Thank!