// Path: jfxvnc-net/src/main/java/org/jfxvnc/net/rfb/codec/security/RfbSecurityDecoder.java
// public interface RfbSecurityDecoder extends ChannelInboundHandler {
// 
// }
// 
// Path: jfxvnc-net/src/main/java/org/jfxvnc/net/rfb/codec/security/RfbSecurityEncoder.java
// public interface RfbSecurityEncoder extends ChannelOutboundHandler {
// 
// }
// 
// Path: jfxvnc-net/src/main/java/org/jfxvnc/net/rfb/codec/security/RfbSecurityHandshaker.java
// public abstract class RfbSecurityHandshaker {
// 
//   public abstract RfbSecurityDecoder newSecurityDecoder();
// 
//   public abstract RfbSecurityEncoder newSecurityEncoder();
// 
//   private AtomicBoolean handshakeComplete = new AtomicBoolean(false);
// 
//   private final SecurityType securityType;
// 
//   public RfbSecurityHandshaker(SecurityType securityType) {
//     this.securityType = securityType;
//   }
// 
//   public boolean isHandshakeComplete() {
//     return handshakeComplete.get();
//   }
// 
//   private void setHandshakeComplete() {
//     handshakeComplete.set(true);
//   }
// 
//   public ChannelFuture handshake(Channel channel, boolean sendResponse) {
//     return handshake(channel, sendResponse, channel.newPromise());
//   }
// 
//   public final ChannelFuture handshake(Channel channel, boolean sendResponse, ChannelPromise promise) {
//     ChannelPipeline p = channel.pipeline();
//     ChannelHandlerContext ctx = p.context(RfbClientDecoder.class);
//     p.addBefore(ctx.name(), "rfb-security-decoder", newSecurityDecoder());
// 
//     ChannelHandlerContext ctx2 = p.context(RfbClientEncoder.class);
//     p.addBefore(ctx2.name(), "rfb-security-encoder", newSecurityEncoder());
//     if (!sendResponse) {
//       return promise.setSuccess();
//     }
//     channel.writeAndFlush(Unpooled.buffer(1).writeByte(securityType.getType()), promise);
//     return promise;
//   }
// 
//   public final void finishHandshake(Channel channel, RfbSecurityMessage message) {
//     setHandshakeComplete();
// 
//     ChannelPipeline p = channel.pipeline();
//     p.remove("rfb-security-decoder");
//     p.remove("rfb-security-encoder");
// 
//   }
// 
// }
// 
// Path: jfxvnc-net/src/main/java/org/jfxvnc/net/rfb/codec/security/SecurityType.java
// public enum SecurityType {
// 
//   UNKNOWN(-1), INVALID(0), NONE(1), VNC_Auth(2), RA2(5), RA2ne(6), Tight(16), Ultra(17), TLS(18), VeNCrypt(19), GTK_VNC_SAS(20), MD5(21), Colin_Dean_xvp(22);
// 
//   private final int type;
// 
//   private SecurityType(int type) {
//     this.type = type;
//   }
// 
//   public static SecurityType valueOf(int type) {
//     for (SecurityType e : values()) {
//       if (e.type == type) {
//         return e;
//       }
//     }
//     return UNKNOWN;
//   }
// 
//   public int getType() {
//     return type;
//   }
// }


import org.jfxvnc.net.rfb.codec.security.RfbSecurityEncoder;
import org.jfxvnc.net.rfb.codec.security.RfbSecurityHandshaker;
import org.jfxvnc.net.rfb.codec.security.SecurityType;
import org.jfxvnc.net.rfb.codec.security.RfbSecurityDecoder;
/*******************************************************************************
 * Copyright (c) 2016 comtel inc.
 *
 * Licensed under the Apache License, version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 *******************************************************************************/
package org.jfxvnc.net.rfb.codec.security.vncauth;


public class VncAuthHandshaker extends RfbSecurityHandshaker {

  public VncAuthHandshaker(SecurityType securityType) {
    super(securityType);
  }

  @Override
  public RfbSecurityDecoder newSecurityDecoder() {
    return new VncAuthDecoder();
  }

  @Override
// Path: jfxvnc-net/src/main/java/org/jfxvnc/net/rfb/codec/security/RfbSecurityDecoder.java
// public interface RfbSecurityDecoder extends ChannelInboundHandler {
// 
// }
// 
// Path: jfxvnc-net/src/main/java/org/jfxvnc/net/rfb/codec/security/RfbSecurityEncoder.java
// public interface RfbSecurityEncoder extends ChannelOutboundHandler {
// 
// }
// 
// Path: jfxvnc-net/src/main/java/org/jfxvnc/net/rfb/codec/security/RfbSecurityHandshaker.java
// public abstract class RfbSecurityHandshaker {
// 
//   public abstract RfbSecurityDecoder newSecurityDecoder();
// 
//   public abstract RfbSecurityEncoder newSecurityEncoder();
// 
//   private AtomicBoolean handshakeComplete = new AtomicBoolean(false);
// 
//   private final SecurityType securityType;
// 
//   public RfbSecurityHandshaker(SecurityType securityType) {
//     this.securityType = securityType;
//   }
// 
//   public boolean isHandshakeComplete() {
//     return handshakeComplete.get();
//   }
// 
//   private void setHandshakeComplete() {
//     handshakeComplete.set(true);
//   }
// 
//   public ChannelFuture handshake(Channel channel, boolean sendResponse) {
//     return handshake(channel, sendResponse, channel.newPromise());
//   }
// 
//   public final ChannelFuture handshake(Channel channel, boolean sendResponse, ChannelPromise promise) {
//     ChannelPipeline p = channel.pipeline();
//     ChannelHandlerContext ctx = p.context(RfbClientDecoder.class);
//     p.addBefore(ctx.name(), "rfb-security-decoder", newSecurityDecoder());
// 
//     ChannelHandlerContext ctx2 = p.context(RfbClientEncoder.class);
//     p.addBefore(ctx2.name(), "rfb-security-encoder", newSecurityEncoder());
//     if (!sendResponse) {
//       return promise.setSuccess();
//     }
//     channel.writeAndFlush(Unpooled.buffer(1).writeByte(securityType.getType()), promise);
//     return promise;
//   }
// 
//   public final void finishHandshake(Channel channel, RfbSecurityMessage message) {
//     setHandshakeComplete();
// 
//     ChannelPipeline p = channel.pipeline();
//     p.remove("rfb-security-decoder");
//     p.remove("rfb-security-encoder");
// 
//   }
// 
// }
// 
// Path: jfxvnc-net/src/main/java/org/jfxvnc/net/rfb/codec/security/SecurityType.java
// public enum SecurityType {
// 
//   UNKNOWN(-1), INVALID(0), NONE(1), VNC_Auth(2), RA2(5), RA2ne(6), Tight(16), Ultra(17), TLS(18), VeNCrypt(19), GTK_VNC_SAS(20), MD5(21), Colin_Dean_xvp(22);
// 
//   private final int type;
// 
//   private SecurityType(int type) {
//     this.type = type;
//   }
// 
//   public static SecurityType valueOf(int type) {
//     for (SecurityType e : values()) {
//       if (e.type == type) {
//         return e;
//       }
//     }
//     return UNKNOWN;
//   }
// 
//   public int getType() {
//     return type;
//   }
// }


// Path: jfxvnc-net/src/main/java/org/jfxvnc/net/rfb/codec/security/vncauth/VncAuthHandshaker.java
import org.jfxvnc.net.rfb.codec.security.RfbSecurityEncoder;
import org.jfxvnc.net.rfb.codec.security.RfbSecurityHandshaker;
import org.jfxvnc.net.rfb.codec.security.SecurityType;
import org.jfxvnc.net.rfb.codec.security.RfbSecurityDecoder;

/*******************************************************************************
 * Copyright (c) 2016 comtel inc.
 *
 * Licensed under the Apache License, version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 *******************************************************************************/
package org.jfxvnc.net.rfb.codec.security.vncauth;


public class VncAuthHandshaker extends RfbSecurityHandshaker {

  public VncAuthHandshaker(SecurityType securityType) {
    super(securityType);
  }

  @Override
  public RfbSecurityDecoder newSecurityDecoder() {
    return new VncAuthDecoder();
  }

  @Override
  public RfbSecurityEncoder newSecurityEncoder() {