The best place to look for sample code is at the source code for twiddle, which is the command-line equivalent of jmx-console. The source can be found in the JBossAS source at console/src/main/org/jboss/console/twiddle[/command]. Look especially at the execute() methos in the *Command classes.
For a quick start, and example JMX code can be found at http://wiki.jboss.org/wiki/Wiki.jsp?page=HowDoIGetRemoteAccessToMyMBean
And the JMX docs are at http://java.sun.com/j2se/1.5.0/docs/guide/jmx/