Code example for Socket

Methods: getPort

0
                    server.requestHandler.onRequest(exchange);
                } 
            } 
        }; 
         
        connectionThread.setName("Server connection " + socket.getPort() + "->" + server.getLocalPort());
        connectionThread.start();
    } 
     
    void close() { 
        closing = true;
 
        try { 
            socket.close();
        } catch(IOException e) {
            throw new RuntimeException(e);
        } 
 
        server.connectionClosed(this);
    }