/** * Actually start working on outgoing connections. * Classes should override to start UDP side as well. * * Not specified in I2PTunnelTask but used in both * I2PTunnelClientBase and I2PTunnelServer so let's * implement it here too. */ public void startRunning() { synchronized (startLock) { try { _session.connect(); } catch(I2PSessionException exc) { throw new RuntimeException("failed to connect session", exc); } start(); startLock.notify(); } open = true; }
/** @since 0.9.21 */ private void verifySession(I2PSession session) throws I2PException { if (_isDestroyed.get()) throw new I2PException("Session was closed"); if (!session.isClosed()) return; session.connect(); }
/** * Classes should override to start UDP side as well. * * Not specified in I2PTunnelTask but used in both * I2PTunnelClientBase and I2PTunnelServer so let's * implement it here too. */ public void startRunning() { //synchronized (startLock) { try { _session.connect(); } catch(I2PSessionException exc) { throw new RuntimeException("failed to connect session", exc); } start(); //} notifyEvent("openServerResult", "ok"); open = true; }
public static int[] getBWLimits(String host, int port) { int[] rv = null; try { I2PClient client = new I2PSimpleClient(); Properties opts = new Properties(); opts.put(I2PClient.PROP_TCP_HOST, host); opts.put(I2PClient.PROP_TCP_PORT, "" + port); I2PSession session = client.createSession(null, opts); session.connect(); rv = session.bandwidthLimits(); session.destroySession(); } catch (I2PSessionException ise) {} return rv; }
session.connect(); I2PSocketManager sockMgr = createManager(session, opts, "manager"); return sockMgr;
/** * Create a new SAM message-based session handler * * @param destStream Input stream containing the destination keys * @param props Properties to setup the I2P session * @throws I2PSessionException */ public SAMMessageSessionHandler(InputStream destStream, Properties props) throws I2PSessionException { if (_log.shouldLog(Log.DEBUG)) _log.debug("Instantiating new SAM message-based session handler"); I2PClient client = I2PClientFactory.createClient(); if (!props.containsKey("inbound.nickname") && !props.containsKey("outbound.nickname")) { props.setProperty("inbound.nickname", "SAM UDP Client"); props.setProperty("outbound.nickname", "SAM UDP Client"); } _session = client.createSession(destStream, props); if (_log.shouldLog(Log.DEBUG)) _log.debug("Connecting I2P session..."); _session.connect(); if (_log.shouldLog(Log.DEBUG)) _log.debug("I2P session connected"); _session.addMuxedSessionListener(this, listenProtocol, listenPort); }
protected I2PSession createSession() throws Exception { I2PClient client = I2PClientFactory.createClient(); ByteArrayOutputStream baos = new ByteArrayOutputStream(512); client.createDestination(baos); Properties p = getProperties(); I2PSession sess = client.createSession(new ByteArrayInputStream(baos.toByteArray()), p); sess.connect(); return sess; }
socketMgr.getSession().connect(); } catch (I2PSessionException ise) { throw new SAMException("Error creating I2PSocketManager: " + ise.getMessage(), ise);
try { session = client.createSession(null, opts); session.connect(); rv = session.lookupDest(key, DEFAULT_TIMEOUT); } finally {
try { session = client.createSession(null, opts); session.connect(); d = session.lookupDest(name); } catch (I2PSessionException ise) {
while (sockMgr.getSession().isClosed()) { try { sockMgr.getSession().connect(); synchronized(I2PTunnelClientBase.class) { if (sockMgr == socketManager)
/** @since 0.9.21 */ private void verifySession(I2PSession session) throws I2PException { if (_isDestroyed.get()) throw new I2PException("Session was closed"); if (!session.isClosed()) return; session.connect(); }
private Ping() throws Exception { Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { try { i2pSession.destroySession(); System.out.println("Finished"); } catch (I2PSessionException e) { e.printStackTrace(); } } }); // initialize i2pSession I2PClient i2pClient = I2PClientFactory.createClient(); ByteArrayOutputStream arrayStream = new ByteArrayOutputStream(); i2pClient.createDestination(arrayStream); byte[] destinationArray = arrayStream.toByteArray(); i2pSession = i2pClient.createSession(new ByteArrayInputStream(destinationArray), null); i2pSession.connect(); }
session.connect(); I2PSocketManager sockMgr = createManager(session, opts, "manager"); return sockMgr;
i2pSession.connect();