in netbeans.apache.org/buildSrc/src/main/groovy/TomcatStopMain.groovy [33:42]
public void stop() {
final InetAddress ia = Inet4Address.localHost
final InetSocketAddress isa = new InetSocketAddress(ia, shutdownPort)
final SocketChannel sc = SocketChannel.open(isa)
try {
sc.write(ByteBuffer.wrap(shutdownCommand.getBytes("UTF-8")))
} finally {
sc.close()
}
}