private IRCConnection getIRConnection( String host, int port, String password, String nick, String alternateNick,
String userName, String realName, String channel, boolean ssl )
throws IOException
{
String key = getConnectionKey( host, port, nick, alternateNick );
IRCConnection conn = hostConnections.get( key );
if ( conn != null )
{
checkConnection( conn, key );
return conn;
}
if ( !ssl )
{
conn = new IRCConnection( host, new int[]{port}, password, nick, userName, realName );
}
else
{
conn = new SSLIRCConnection( host, new int[]{port}, password, nick, userName, realName );
( (SSLIRCConnection) conn ).addTrustManager( new SSLDefaultTrustManager() );
}
conn.addIRCEventListener( new Listener( conn, nick, alternateNick ) );
checkConnection( conn, key );
checkChannel( conn, key, channel );
hostConnections.put( key, conn );
return conn;
}