Examples of UdpNetworkLocation


Examples of tahrir.io.net.udpV1.UdpNetworkLocation

    if (config.localHostName != null) {
      modifyPublicNodeId(new ModifyBlock<RemoteNodeAddress>() {

        public void run(final RemoteNodeAddress remoteNodeAddress, final Modified modified) {
          try {
            remoteNodeAddress.physicalLocation = new UdpNetworkLocation(InetAddress.getByName(config.localHostName),
                config.udp.listenPort);
          } catch (final UnknownHostException e) {
            logger.error("Failed to set local node address", e);
          }
        }
View Full Code Here

Examples of tahrir.io.net.udpV1.UdpNetworkLocation

        }
    }

    public static RemoteNodeAddress genericRemoteNodeAddress() {
        final RSAPublicKey pubKey = TrCrypto.createRsaKeyPair().a;
        final PhysicalNetworkLocation location = new UdpNetworkLocation(genericInetAddress(), genericPort());
        return new RemoteNodeAddress(location, pubKey);
    }
View Full Code Here

Examples of tahrir.io.net.udpV1.UdpNetworkLocation

    final TrSessionManager sessionMgr2 = new TrSessionManager(node2, iface2, false);

    sessionMgr2.registerSessionClass(TestSession.class, TestSessionImpl.class);

    final TrRemoteConnection one2two = sessionMgr1.connectionManager.getConnection(
        new RemoteNodeAddress(new UdpNetworkLocation(InetAddress.getByName("127.0.0.1"), udpNetIfaceConf2.listenPort), kp2.a), false,
        "sessionMgr1");
    final TrRemoteConnection two2one = sessionMgr2.connectionManager.getConnection(
        new RemoteNodeAddress(new UdpNetworkLocation(InetAddress.getByName("127.0.0.1"), udpNetIfaceConf1.listenPort), kp1.a), false,
        "sessionMgr2");

    remoteSession = sessionMgr1.getOrCreateRemoteSession(TestSession.class, one2two, 1234);
  }
View Full Code Here

Examples of tahrir.io.net.udpV1.UdpNetworkLocation

    Assert.assertEquals(ot2.subObj.i, ot.subObj.i);
  }

  @Test
  public void trPeerInfoTest() throws Exception {
    final TrPeerInfo ot = new TrPeerInfo(new RemoteNodeAddress(new UdpNetworkLocation(InetAddress.getByName("127.0.0.1"), 1234), TrCrypto.createRsaKeyPair().a));
    final ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
    final DataOutputStream dos = new DataOutputStream(baos);
    TrSerializer.serializeTo(ot, dos);
    final DataInputStream dis = new DataInputStream(new ByteArrayInputStream(baos.toByteArray()));
    final TrPeerInfo ot2 = TrSerializer.deserializeFrom(TrPeerInfo.class, dis);
View Full Code Here

Examples of tahrir.io.net.udpV1.UdpNetworkLocation

  @Override
  protected PhysicalNetworkLocation deserialize(final Type type, final DataInputStream dis) throws IOException,
  TrSerializableException {
    final byte raType = dis.readByte();
    if (raType == UDP_REMOTE_ADDRESS)
      return new UdpNetworkLocation(TrSerializer.deserializeFrom(InetAddress.class, dis), dis.readInt());
    else
      throw new TrSerializableException("Unrecognised TrRemoteAddress type: " + raType);
  }
View Full Code Here

Examples of tahrir.io.net.udpV1.UdpNetworkLocation

  TrSerializableException {
    if (!(object instanceof UdpNetworkLocation))
      throw new TrSerializableException("Unrecognized TrRemoteAddress type: " + object.getClass());
    else {
      dos.writeByte(UDP_REMOTE_ADDRESS);
      final UdpNetworkLocation ura = (UdpNetworkLocation) object;
      TrSerializer.serializeTo(ura.inetAddress, dos);
      dos.writeInt(ura.port);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.