Examples of DisconnectMessage


Examples of com.twitter.hbc.twitter4j.message.DisconnectMessage

  @Test
  public void testParseDisconnectMessage() throws JSONException {
    JSONObject json = new JSONObject(disconnectMessage);
    assertFalse(JSONObjectParser.hasSitestreamUser(json));
    assertFalse(JSONObjectParser.hasSitestreamMessage(json));
    DisconnectMessage message = JSONObjectParser.parseDisconnectMessage(json);
    assertEquals(message.getDisconnectCode(), 5);
    assertEquals(message.getStreamName(), "somestreamname123");
    assertEquals(message.getDisconnectReason(), "reason for disconnection");
  }
View Full Code Here

Examples of com.twitter.hbc.twitter4j.message.DisconnectMessage

  public static DisconnectMessage parseDisconnectMessage(JSONObject message) throws JSONException {
    JSONObject json = message.getJSONObject("disconnect");
    int code = json.getInt("code");
    String streamName = json.getString("stream_name");
    String reason = json.getString("reason");
    return new DisconnectMessage(code, streamName, reason);
  }
View Full Code Here

Examples of org.ethereum.net.p2p.DisconnectMessage

     */
    public void processStatus(StatusMessage msg, ChannelHandlerContext ctx) throws InterruptedException {

        this.handshakeStatusMessage = msg;
        if (peerDiscoveryMode) {
            msgQueue.sendMessage(new DisconnectMessage(ReasonCode.REQUESTED));
            killTimers();
            ctx.close().sync();
            ctx.disconnect().sync();
            return;
        }

        if (!Arrays.equals(msg.getGenesisHash(), Blockchain.GENESIS_HASH)
                || msg.getProtocolVersion() != EthHandler.VERSION) {
            logger.info("Removing EthHandler for {} due to protocol incompatibility", ctx.channel().remoteAddress());
//      msgQueue.sendMessage(new DisconnectMessage(ReasonCode.INCOMPATIBLE_NETWORK));
            ctx.pipeline().remove(this); // Peer is not compatible for the 'eth' sub-protocol
        } else if (msg.getNetworkId() != EthHandler.NETWORK_ID)
            msgQueue.sendMessage(new DisconnectMessage(ReasonCode.INCOMPATIBLE_NETWORK));
        else {
            BlockQueue chainQueue = blockchain.getQueue();
            BigInteger peerTotalDifficulty = new BigInteger(1, msg.getTotalDifficulty());
            BigInteger highestKnownTotalDifficulty = blockchain.getTotalDifficulty();
            if ( highestKnownTotalDifficulty == null ||
View Full Code Here

Examples of org.hornetq.core.protocol.core.impl.wireformat.DisconnectMessage

      {
         final byte type = packet.getType();

         if (type == PacketImpl.DISCONNECT)
         {
            final DisconnectMessage msg = (DisconnectMessage) packet;

            SimpleString nodeID = msg.getNodeID();

            if (HornetQClientLogger.LOGGER.isTraceEnabled())
            {
               HornetQClientLogger.LOGGER.trace("Disconnect being called on client:" + msg +
                                                   " server locator = " +
                                                   serverLocator +
                                                   " notifying node " +
                                                   nodeID +
                                                   " as down", new Exception("trace"));
            }

            if (nodeID != null)
            {
               serverLocator.notifyNodeDown(System.currentTimeMillis(), msg.getNodeID().toString());
            }

            closeExecutor.execute(new CloseRunnable(conn));
         }
         else if (type == PacketImpl.CLUSTER_TOPOLOGY)
View Full Code Here

Examples of org.hornetq.core.protocol.core.impl.wireformat.DisconnectMessage

      {
         final byte type = packet.getType();

         if (type == PacketImpl.DISCONNECT)
         {
            final DisconnectMessage msg = (DisconnectMessage)packet;

            SimpleString nodeID = msg.getNodeID();

            if (ClientSessionFactoryImpl.log.isTraceEnabled())
            {
               ClientSessionFactoryImpl.log.trace("Disconnect being called on client:" + msg +
                                                  " server locator = " +
                                                  serverLocator +
                                                  " notifying node " +
                                                  nodeID +
                                                  " as down", new Exception("trace"));
            }

            if (nodeID != null)
            {
               serverLocator.notifyNodeDown(System.currentTimeMillis(), msg.getNodeID().toString());
            }

            closeExecutor.execute(new Runnable()
            {
               // Must be executed on new thread since cannot block the netty thread for a long time and fail can
View Full Code Here

Examples of org.hornetq.core.protocol.core.impl.wireformat.DisconnectMessage

      for (Channel channel: allChannels)
      {
         channel.flushConfirmations();
      }

      Packet disconnect = new DisconnectMessage(nodeID);
      channel0.sendAndFlush(disconnect);
   }
View Full Code Here

Examples of org.hornetq.core.protocol.core.impl.wireformat.DisconnectMessage

      {
         final byte type = packet.getType();

         if (type == PacketImpl.DISCONNECT)
         {
            final DisconnectMessage msg = (DisconnectMessage)packet;

            SimpleString nodeID = msg.getNodeID();

            if (ClientSessionFactoryImpl.log.isTraceEnabled())
            {
               ClientSessionFactoryImpl.log.trace("Disconnect being called on client:" + msg +
                                                  " server locator = " +
                                                  serverLocator +
                                                  " notifying node " +
                                                  nodeID +
                                                  " as down", new Exception("trace"));
            }

            if (nodeID != null)
            {
               serverLocator.notifyNodeDown(System.currentTimeMillis(), msg.getNodeID().toString());
            }

            closeExecutor.execute(new Runnable()
            {
               // Must be executed on new thread since cannot block the netty thread for a long time and fail can
View Full Code Here

Examples of org.hornetq.core.protocol.core.impl.wireformat.DisconnectMessage

      for (Channel channel: allChannels)
      {
         channel.flushConfirmations();
      }

      Packet disconnect = new DisconnectMessage(nodeID);
      channel0.sendAndFlush(disconnect);
   }
View Full Code Here

Examples of org.hornetq.core.protocol.core.impl.wireformat.DisconnectMessage

      {
         final byte type = packet.getType();

         if (type == PacketImpl.DISCONNECT)
         {
            final DisconnectMessage msg = (DisconnectMessage)packet;

            SimpleString nodeID = msg.getNodeID();

            if (ClientSessionFactoryImpl.log.isTraceEnabled())
            {
               ClientSessionFactoryImpl.log.trace("Disconnect being called on client:" + msg +
                                                  " server locator = " +
                                                  serverLocator +
                                                  " notifying node " +
                                                  nodeID +
                                                  " as down", new Exception("trace"));
            }

            if (nodeID != null)
            {
               serverLocator.notifyNodeDown(System.currentTimeMillis(), msg.getNodeID().toString());
            }

            closeExecutor.execute(new Runnable()
            {
               // Must be executed on new thread since cannot block the netty thread for a long time and fail can
View Full Code Here

Examples of org.hornetq.core.protocol.core.impl.wireformat.DisconnectMessage

      {
         final byte type = packet.getType();

         if (type == PacketImpl.DISCONNECT)
         {
            final DisconnectMessage msg = (DisconnectMessage)packet;

            SimpleString nodeID = msg.getNodeID();

            if (HornetQClientLogger.LOGGER.isTraceEnabled())
            {
               HornetQClientLogger.LOGGER.trace("Disconnect being called on client:" + msg +
                                                  " server locator = " +
                                                  serverLocator +
                                                  " notifying node " +
                                                  nodeID +
                                                  " as down", new Exception("trace"));
            }

            if (nodeID != null)
            {
               serverLocator.notifyNodeDown(System.currentTimeMillis(), msg.getNodeID().toString());
            }

            closeExecutor.execute(new CloseRunnable(conn));
         }
         else if (type == PacketImpl.CLUSTER_TOPOLOGY)
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.