Package org.ardverk.dht.message

Examples of org.ardverk.dht.message.MessageId


   
    /**
     * Returns {@code true} if the {@link ResponseMessage} is OK.
     */
    public boolean check(ResponseMessage response) {
      MessageId messageId = response.getMessageId();
      if (!history.add(messageId)) {
        if (LOG.isErrorEnabled()) {
          LOG.error("Multiple respones: " + response);
        }
        return false;
View Full Code Here


    if (version != Constants.VERSION) {
      throw new IOException("version=" + version);
    }
   
    OpCode opcode = readEnum(OpCode.class);
    MessageId messageId = readMessageId();
    Contact contact = readSender(opcode.isRequest()
        ? Contact.Type.UNSOLICITED : Contact.Type.SOLICITED, src);
    SocketAddress address = readSocketAddress();
   
    switch (opcode) {
View Full Code Here

  @Test
  public void encodeDecode() throws IOException {
    BencodeMessageCodec codec
      = new BencodeMessageCodec();
   
    MessageId messageId = MessageId.createRandom(20);
    KUID contactId = KUID.createRandom(20);
   
    Contact contact = new DefaultContact(Type.SOLICITED,
        contactId, 0, false,
        new InetSocketAddress("localhost", 6666));
View Full Code Here

   * Callback method for outgoing {@link Message} that failed to be sent.
   * Returns {@code true} if the {@link Throwable} was handled or not.
   */
  public boolean handleException(Endpoint endpoint,
      Message message, Throwable t) {
    MessageId messageId = message.getMessageId();
    MessageEntity entity = entityManager.get(messageId);
   
    if (entity != null) {
      entity.handleException(t);
      return true;
View Full Code Here

     * Adds a {@link RequestEntity} and its {@link MessageCallback}.
     */
    public void add(MessageCallback callback, RequestEntity entity,
        long timeout, TimeUnit unit) {
     
      final MessageId messageId = entity.getMessageId();
     
      synchronized (callbacks) {
       
        if (!open) {
          throw new IllegalStateException();
View Full Code Here

TOP

Related Classes of org.ardverk.dht.message.MessageId

Copyright © 2018 www.massapicom. 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.