Package org.serviceconnector.scmp

Examples of org.serviceconnector.scmp.SCMPKeepAlive


        }
      }
      this.usedConnections.add(connection);
    }
    // send a keep alive message
    SCMPKeepAlive keepAliveMessage = new SCMPKeepAlive();
    connection.incrementNrOfIdles();
    try {
      ConnectionPoolCallback callback = new ConnectionPoolCallback(true);
      connection.send(keepAliveMessage, callback);
      SCMPMessage reply = callback.getMessageSync(this.keepAliveOTIMillis);
View Full Code Here


    // evaluating header key and creating corresponding SCMP type
    SCMPHeaderKey headerKey = SCMPHeaderKey.getKeyByHeadline(headline);
    switch (headerKey) {
    case KRS:
    case KRQ:
      scmpMsg = new SCMPKeepAlive();
      return scmpMsg;
    case PRQ:
    case PRS:
      // no poll request
      scmpMsg = new SCMPPart(false);
View Full Code Here

  /** {@inheritDoc} */
  @Override
  public void encode(OutputStream os, Object obj) throws Exception {
    OutputStreamWriter osw = new OutputStreamWriter(os, Constants.SC_CHARACTER_SET);
    BufferedWriter bw = new BufferedWriter(osw);
    SCMPKeepAlive keepAlive = (SCMPKeepAlive) obj;
    if (keepAlive.isReply()) {
      SCMPHeaderKey headerKey = SCMPHeaderKey.KRS;
      writeHeadLine(bw, headerKey, 0, 0);
    } else {
      SCMPHeaderKey headerKey = SCMPHeaderKey.KRQ;
      writeHeadLine(bw, headerKey, 0, 0);
View Full Code Here

    String requestString = TestUtil.getSCMPString(headKey, null, null);

    byte[] buffer = requestString.getBytes();
    InputStream is = new ByteArrayInputStream(buffer);
    IEncoderDecoder coder = coderFactory.createEncoderDecoder(new SCMPKeepAlive(SCMPVersion.CURRENT));

    SCMPMessage message = null;
    try {
      message = (SCMPMessage) coder.decode(is);
    } catch (Exception e) {
View Full Code Here

    this.headKey = SCMPHeaderKey.KRS;
    String requestString = headKey.name() + " 0000000 00000 1.0\n";

    byte[] buffer = requestString.getBytes();
    InputStream is = new ByteArrayInputStream(buffer);
    IEncoderDecoder coder = coderFactory.createEncoderDecoder(new SCMPKeepAlive(SCMPVersion.CURRENT));

    SCMPMessage message = null;
    try {
      message = (SCMPMessage) coder.decode(is);
    } catch (Exception e) {
View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t10_EncodeKRQTest() {
    this.headKey = SCMPHeaderKey.KRQ;
    this.encodeScmp = new SCMPKeepAlive(SCMPVersion.CURRENT);
    IEncoderDecoder coder = coderFactory.createEncoderDecoder(new SCMPKeepAlive(SCMPVersion.CURRENT));

    String expectedString = this.headKey.name() + " 0000000 00000 " + SCMPVersion.CURRENT + "\n";

    OutputStream os = new ByteArrayOutputStream();
    try {
View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t11_EncodeKRSTest() {
    this.headKey = SCMPHeaderKey.KRS;
    this.encodeScmp = new SCMPKeepAlive(SCMPVersion.CURRENT);
    IEncoderDecoder coder = coderFactory.createEncoderDecoder(new SCMPKeepAlive(SCMPVersion.CURRENT));

    String expectedString = this.headKey.name() + " 0000000 00000 " + SCMPVersion.CURRENT + "\n";

    OutputStream os = new ByteArrayOutputStream();
    try {
View Full Code Here

    String requestString = TestUtil.getSCMPString(headKey, null, null);

    byte[] buffer = requestString.getBytes();
    InputStream is = new ByteArrayInputStream(buffer);
    IEncoderDecoder coder = coderFactory.createEncoderDecoder(new SCMPKeepAlive());

    SCMPMessage message = null;
    try {
      message = (SCMPMessage) coder.decode(is);
    } catch (Exception e) {
View Full Code Here

    this.headKey = SCMPHeaderKey.KRS;
    String requestString = headKey.name() + " 0000000 00000 1.0\n";

    byte[] buffer = requestString.getBytes();
    InputStream is = new ByteArrayInputStream(buffer);
    IEncoderDecoder coder = coderFactory.createEncoderDecoder(new SCMPKeepAlive());

    SCMPMessage message = null;
    try {
      message = (SCMPMessage) coder.decode(is);
    } catch (Exception e) {
View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t10_EncodeKRQTest() {
    this.headKey = SCMPHeaderKey.KRQ;
    this.encodeScmp = new SCMPKeepAlive();
    IEncoderDecoder coder = coderFactory.createEncoderDecoder(new SCMPKeepAlive());

    String expectedString = this.headKey.name() + " 0000000 00000 " + SCMPVersion.CURRENT + "\n";

    OutputStream os = new ByteArrayOutputStream();
    try {
View Full Code Here

TOP

Related Classes of org.serviceconnector.scmp.SCMPKeepAlive

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.