Package com.firefly.net.tcp.ssl

Examples of com.firefly.net.tcp.ssl.SSLSession


  public void sessionOpened(Session session) throws Throwable {
    SessionAttachment sessionAttachment = new SessionAttachment();
    session.attachObject(sessionAttachment);
    Monitor.CONN_COUNT.incrementAndGet();
    if(sslContext != null) {
      sessionAttachment.sslSession = new SSLSession(sslContext, session);
    }
    httpConnectionListener.connectionCreated(session);
  }
View Full Code Here


  }

  @Override
  public void sessionOpened(Session session) throws Throwable {
    SessionInfo info = new SessionInfo();
    info.sslSession = new SSLSession(sslContext, session);
    session.attachObject(info);

  }
View Full Code Here

  private DumpDecoder next = new DumpDecoder();

  @Override
  public void decode(ByteBuffer buf, Session session) throws Throwable {
    SessionInfo info = (SessionInfo)session.getAttachment();
    SSLSession c = info.sslSession;

    ByteBuffer plaintext = c.read(buf);
    if(plaintext != null)
      next.decode(plaintext, session);
  }
View Full Code Here

public class SSLEncoder implements Encoder {

  @Override
  public void encode(Object message, Session session) throws Throwable {
    SessionInfo info = (SessionInfo)session.getAttachment();
    SSLSession c = info.sslSession;
   
    if(message instanceof String) {
      byte[] body = ((String)message).getBytes("UTF-8");
      byte[] head = ("HTTP/1.1 200 OK\r\n"
          + "Server: firefly-server/1.0\r\n"
          + "Content-Length: " + body.length + "\r\n"
          + "\r\n")
        .getBytes("UTF-8");
   
      c.write(ByteBuffer.wrap(head));
      c.write(ByteBuffer.wrap(body));
    } else if (message instanceof FileChannel) {
      Long length = info.length;
      byte[] head = ("HTTP/1.1 200 OK\r\n"
          + "Server: firefly-server/1.0\r\n"
          + "Content-Length: " + length + "\r\n"
          + "\r\n")
        .getBytes("UTF-8");
     
      c.write(ByteBuffer.wrap(head));
      c.transferTo((FileChannel)message, 0, length);
    }
  }
View Full Code Here

TOP

Related Classes of com.firefly.net.tcp.ssl.SSLSession

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.