@Override public void stop() throws NetworkException { try { client.close(); } catch (IOException e) { throw new NetworkException(e); } }
@Override public void init() throws NetworkException { try { client = new JGNClient( new InetSocketAddress(InetAddress.getLocalHost(), 0), new InetSocketAddress(InetAddress.getLocalHost(), 0)); client.addServerConnectionListener(this); } catch (UnknownHostException e) { throw new NetworkException(e); } catch (IOException e) { throw new NetworkException(e); } }
@Override public void start() throws NetworkException { try { JGN.createThread(client).start(); client.connectAndWait( new InetSocketAddress(InetAddress.getLocalHost(), getTcpPort()), new InetSocketAddress(InetAddress.getLocalHost(), getUdpPort()), 5000); } catch (UnknownHostException e) { throw new NetworkException(e); } catch (IOException e) { throw new NetworkException(e); } catch (InterruptedException e) { throw new NetworkException(e); } }