Java protocol handler example