I came across a sample code from Apache Mina. The code is pasted below, but can be found here.
public static void main(String[] args) throws Exception {
    if (args.length != 3) {
        System.out.println(Main.class.getName()
                + " <proxy-port> <server-hostname> <server-port>");
        return;
    }
    // Create TCP/IP acceptor.
    NioSocketAcceptor acceptor = new NioSocketAcceptor();
    // Create TCP/IP connector.
    IoConnector connector = new NioSocketConnector();
    // Set connect timeout.
    connector.setConnectTimeoutMillis(30*1000L);
    ClientToProxyIoHandler handler = new ClientToProxyIoHandler(connector,
            new InetSocketAddress(args[1], Integer.parseInt(args[2])));
    // Start proxy.
    acceptor.setHandler(handler);
    acceptor.bind(new InetSocketAddress(Integer.parseInt(args[0])));
    System.out.println("Listening on port " + Integer.parseInt(args[0]));
}
I ran the code. It turns out that the JVM continues to run after printing out "Listening on port...". I don't understand why that is possible. Can someone explain that? Thank you very much.