anchor.diff:  
   %%
   %%
  -init([Sup, {listen, _Peer, _Opts}=Msg]) ->
  -   {ok, 'LISTEN', init(Sup, Msg)}; 
  -
  -init([Sup, {accept, _Peer, _Opts}=Msg]) ->
  -   {ok, 'ACCEPT', init(Sup, Msg), 0};
  -
  -init([Sup, {connect, _Peer, _Opts}=Msg]) ->
  -   {ok, 'CONNECT', init(Sup, Msg), 0};
  -
  -init([{connect, _Peer, _Opts}=Msg]) ->
  -   {ok, 'CONNECT', init(undefined, Msg), 0};
  -
  -init([Sup]) ->
  -   {ok, 'IDLE', #fsm{sup=Sup}}.
  +init([Sup, {listen, _Peer}=Msg, Opts]) ->
  +   {ok, 'LISTEN', init(Msg, #fsm{sup=Sup, opts=Opts})}; 
  +
  +init([Sup, {accept, _Peer}=Msg, Opts]) ->
  +   {ok, 'ACCEPT', init(Msg, #fsm{sup=Sup, opts=Opts}), 0};
  +
  +init([Opts]) ->
  +   {ok, 'IDLE', #fsm{opts=Opts}}.
  +
  +
  +init({accept, Addr}, S)
  + when is_integer(Addr) ->
  +   init({accept, {any, Addr}}, S); 
  +
  +init({accept, Addr}, #fsm{sup=Sup}=S) ->
  +   Lpid = knet_acceptor_sup:server(Sup),
  +   {ok, [LSock]} = konduit:ioctl(socket, knet_ssl, Lpid),
  +   lager:info("ssl accepting ~p (~p)", [Addr, LSock]),
  +   S#fsm{
  +      role = server,
  +      sock = LSock,
  +      addr = Addr
  +   };
  +
  +init({listen, Port}, S)
  + when is_integer(Port) ->
  +   init({listen, {any, Port}}, S); 
  +
  +init({listen, {<<>>, Port}}, S)
  + when is_integer(Port) ->
  +   init({listen, {any, Port}}, S); 
  +
  +init({listen, Addr}, #fsm{sup=Sup, opts=Opts}=S) ->
  +   % start ssl listener
  +   {IP, Port}  = Addr,
  +   {ok, LSock} = ssl:listen(Port, [
  +      {ip, IP}, 
  +      {reuseaddr, true} | opts(Opts, ?SSL_OPTS) ++ opts(Opts, ?TCP_OPTS) ++ ?SO_TCP
  +   ]),
  +   lager:info("ssl listen on ~p", [Addr]),
  +   % spawn acceptor pool
  +   Pool = proplists:get_value(acceptor, Opts, ?KO_TCP_ACCEPTOR),
  +   spawn_link(
  +      fun() ->
  +         Factory = knet_acceptor_sup:factory(Sup),
  +         [ konduit_sup:spawn(Factory) || _ <- lists:seq(1, Pool) ] 
  +      end
  +   ),
  +   S#fsm{
  +      role = server,
  +      sock = LSock,
  +      addr = Addr
  +   }.
   
   %%
   %%
  
positive.code: %%%
  %%%------------------------------------------------------------------
  
  %%
  %% initializes konduit
  init(Sup, {accept, Addr, Opts}) when is_integer(Addr) ->
     init(Sup, {accept, {any, Addr}, Opts}); 
  
  init(Sup, {accept, Addr, Opts}) ->
     Lpid = knet_acceptor_sup:server(Sup),
     {ok, [LSock]} = konduit:ioctl(socket, knet_ssl, Lpid),  
     lager:info("ssl accepting ~p", [Addr]),
     #fsm{
        role = server,
        sup  = Sup,
        sock = LSock,
        addr = Addr,
        opts = Opts
     };
  
  init(Sup, {listen, Addr, Opts}) when is_integer(Addr) ->
     init(Sup, {listen,  {any, Addr}, Opts}); 
  
  init(Sup, {listen, Addr, Opts}) ->
     % start ssl listener
     {IP, Port}  = Addr,
     {ok, LSock} = ssl:listen(Port, [
     	{ip, IP}, 
     	{reuseaddr, true} | opts(Opts, ?SSL_OPTS) ++ opts(Opts, ?TCP_OPTS) ++ ?SO_TCP
     ]),
     lager:info("ssl listen on ~p", [Addr]),
     % spawn acceptor pool
     {acceptor, Pool} = lists:keyfind(acceptor, 1, Opts),
     spawn_link(
        fun() ->
           Factory = knet_acceptor_sup:factory(Sup),
           [ konduit_sup:spawn(Factory) || _ <- lists:seq(1, Pool) ] 
        end
     ),
     #fsm{
        role = server,
        sup  = Sup,
        sock = LSock,
        addr = Addr,
        opts = Opts
     };
  
  
  
  init(Sup, {connect, Peer, Opts}) ->
     % start tcp/ip client
     #fsm{
        role = client,
        sup  = Sup,
        peer = Peer,
        opts = Opts
     }.
  
  
  %%
  %% 
  iid(inet)  -> ssl4;
  iid(inet6) -> ssl6. 
  
  
  %%
  %% validate that host to connect is an acceptable format
  
negative.code: %%% IDLE: allows to chain ssl konduit
  %%%
  %%%------------------------------------------------------------------
  'IDLE'({connect, Peer}, S) ->
     {next_state, 
        'CONNECT',
        S#fsm{
           role = client,
           peer = Peer
        }, 
        0
     }.
  
  %%%------------------------------------------------------------------
  %%%
  