@Test
public void messageReceivedOpenedUsernamePasswordAuth() throws Exception {

    when(session.getAttribute(Socks5AcceptorHandler.STATE_KEY)).thenReturn(ProxyState.OPENED);
    IoBuffer buffer = IoBuffer.wrap(new byte[] {5, 1, 2});
    
    handler.messageReceived(session, buffer);
    
    verify(session).write(IoBuffer.wrap(new byte[]{5, 0x55}));
    verify(session).close(false);
}