If your code is an applet or running under a java security manager you need to explicitly grant it permissions to do stuff.
In order for a resource access to be allowed for an applet (or an application running with a security manager), the corresponding permission must be explicitly granted to the code attempting the access.
By default your code has no socket permission. Your permission says that your code has the permission to accept connection on, to connect to and to resolve only the host with IP 192.168.1.1
on port 31337
.
The "accept" and "connect" actions are obvious.
The "resolve" action is implied when any of the other actions are
present. The action "resolve" refers to host/ip name service lookups.
The "listen" action is only meaningful when used with "localhost".
The difference between listen and accept is that listening means "be prepared for connection and see if there is a connection waiting" and accepting means "ok, accept it".
See the docs for permissions in java 7. and java.net.SocketPermission java docs