Examples of Sender


Examples of com.crashnote.core.send.Sender

    /**
     * Create an instance of module 'Sender'
     */
    public Sender<C> getSender() {
        return new Sender(this);
    }
View Full Code Here

Examples of com.dragome.debugging.messages.Sender

    if (!(configuredReceiver instanceof ChannelReceiverImpl))
      ServiceLocator.getInstance().getServerToClientMessageChannel().setReceiver(new ChannelReceiverImpl());
    else
      configuredReceiver.reset();

    ServiceLocator.getInstance().getServerToClientMessageChannel().setSender(new Sender()
    {
      public void send(String aMessage)
      {
        broadcaster.broadcast(aMessage);
      }
View Full Code Here

Examples of com.google.android.gcm.server.Sender

        registrationIds.add(device.getRegistrationId());
      }
    }
    GcmMessage gcmMessage = (GcmMessage)pushMessage;
   
    Sender sender = new Sender(Application.get().getAppContext().getGoogleServerApiKey());
    Message.Builder messageBuilder = new Message.Builder();
    if (StringUtils.isNotEmpty(gcmMessage.getCollapseKey())) {
      messageBuilder.collapseKey(gcmMessage.getCollapseKey());
    }
    if (gcmMessage.isDelayWhileIdle() != null) {
      messageBuilder.delayWhileIdle(gcmMessage.isDelayWhileIdle());
    }
    if (gcmMessage.getTimeToLive() != null) {
      messageBuilder.timeToLive(gcmMessage.getTimeToLive());
    }
    for (Entry<String, String> entry : gcmMessage.getParameters().entrySet()) {
      if (entry.getValue() != null) {
        messageBuilder.addData(entry.getKey(), entry.getValue());
      }
    }
    Message message = messageBuilder.build();
    PushResponse pushResponse = new PushResponse();
    try {
      MulticastResult multicastResult = sender.send(message, Lists.newArrayList(registrationIds), 10);
     
      // analyze the results
      for (int i = 0; i < registrationIds.size(); i++) {
        Result result = multicastResult.getResults().get(i);
        Device device = devices.get(i);
View Full Code Here

Examples of com.nokia.dempsy.messagetransport.Sender

         boolean justGetOut = false;
         while(keepGoing.get() && !justGetOut)
         {
            try
            {
               Sender sender = senderFactory.getSender(destination);
               sender.send( ("Hello from " + threadInstance).getBytes());
               sentMessageCount.incrementAndGet();
            }
            catch(MessageTransportException e)
            {
               sendFailed.set(true);
View Full Code Here

Examples of com.nokia.dempsy.messagetransport.Sender

               adaptor.start(); // start the adaptor
               Destination destination = adaptor.getDestination(); // get the destination

               // send a message
               byte[] messageBytes = "Hello".getBytes();
               Sender sender = factory.getSender(destination);
              
               assertEquals((shouldBatch ? TcpTransport.defaultBatchingDelayMillis : -1), ((TcpSender)sender).getBatchOutgoingMessagesDelayMillis());
              
               sender.send(messageBytes);
               sender.send(messageBytes);
              
               // wait for it to be received.
               for (long endTime = System.currentTimeMillis() + baseTimeoutMillis;
                     endTime > System.currentTimeMillis() && receiver.numMessages.get() < 2;)
                  Thread.sleep(1);
View Full Code Here

Examples of com.nokia.dempsy.messagetransport.Sender

               adaptor.start(); // start the adaptor
               Destination destination = adaptor.getDestination(); // get the destination

               // send a message
               Sender sender = factory.getSender(destination);
               sender.send("Hello".getBytes());
              
               // wait for it to be received.
               for (long endTime = System.currentTimeMillis() + baseTimeoutMillis;
                     endTime > System.currentTimeMillis() && receiver.numMessages.get() == 0;)
                  Thread.sleep(1);
View Full Code Here

Examples of com.nokia.dempsy.messagetransport.Sender

               adaptor.start(); // start the adaptor
               Destination destination = adaptor.getDestination(); // get the destination

               // send a message
               Sender sender = factory.getSender(destination);
              
               // send messageBytes
               byte[] messageBytes = "Hello".getBytes();
               int sentBytesPerMessage = messageBytes.length + tcpTransportHeaderSize;
              
               sender.send(messageBytes);
               Thread.sleep(batchOutgoingMessagesDelayMillis * 2);
               sender.send(messageBytes);
               sender.send(messageBytes);
               Thread.sleep(batchOutgoingMessagesDelayMillis * 2);
               sender.send(messageBytes);
              
               // now numBytesLastFlush should be set to the num of bytes that were last flushed.
               // numBytesSent should be the total bytes, even those still in the buffer.
               // Therefore numBytesSent - numBytesLastFlush should be the number of bytes waiting.
               // These are asserted below.
View Full Code Here

Examples of com.nokia.dempsy.messagetransport.Sender

               adaptor.start(); // start the adaptor
               Destination destination = adaptor.getDestination(); // get the destination

               // send a message
               Sender sender = factory.getSender(destination);
              
               int mtu = ((TcpSender)sender).getMtu();
              
               // send enough messages to get one through
               byte[] messageBytes = "Hello".getBytes();
               int numMessagesSent = 0;
               int numBytesSent = 0;
               int numBytesLastFlush = 0;
               while (numBytesSent < mtu)
               {
                  sender.send(messageBytes);
                  numBytesLastFlush = numBytesSent;
                  numBytesSent += messageBytes.length + tcpTransportHeaderSize;
                  numMessagesSent++;
               }
              
View Full Code Here

Examples of com.nokia.dempsy.messagetransport.Sender

               adaptor.start(); // start the adaptor
               Destination destination = adaptor.getDestination(); // get the destination
               Destination destination2 = adaptor2.getDestination(); // get the destination

               // send a message
               Sender sender = factory.getSender(destination);
               factory.getSender(destination2)// create a second sender to make sure the historgram acts correctly
              
               int mtu = ((TcpSender)sender).getMtu();
              
               // now create a message larger than the mtu by 10%
               Random random = new Random();
               byte[] messageBytes = new byte[(int)(mtu * 1.1)];
               for (int i = 0; i < messageBytes.length; i++)
                  messageBytes[i] = (byte)charSet.charAt(random.nextInt(charSet.length()));
              
               // send the message ... it should be sent without delay.
               sender.send(messageBytes);

               // wait for it to be received.
               for (long endTime = System.currentTimeMillis() + baseTimeoutMillis;
                     endTime > System.currentTimeMillis() && receiver.numMessages.get() == 0;)
                  Thread.sleep(1);
View Full Code Here

Examples of com.nokia.dempsy.messagetransport.Sender

               adaptor.start(); // start the adaptor
               Destination destination = adaptor.getDestination(); // get the destination

               // send a message
               Sender sender = factory.getSender(destination);
              
               int mtu = ((TcpSender)sender).getMtu();
              
               // now create a message larger than the mtu by 10%
               Random random = new Random();
               byte[] largeMessageBytes = new byte[(int)(mtu * 1.1)];
               for (int i = 0; i < largeMessageBytes.length; i++)
                  largeMessageBytes[i] = (byte)charSet.charAt(random.nextInt(charSet.length()));
              
               byte[] messageBytes = "Hello".getBytes();
              
               // send the message ... it should be sent without delay.
               sender.send(largeMessageBytes); // this should flush everything
               sender.send(messageBytes); // this should wait for another message.
               sender.send(messageBytes); // this should wait for another message.
               sender.send(largeMessageBytes); // this should flush everything

               // wait for it to be received.
               for (long endTime = System.currentTimeMillis() + baseTimeoutMillis;
                     endTime > System.currentTimeMillis() && receiver.numMessages.get() < 4;)
                  Thread.sleep(1);
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.