Use a connection factory instead of a connection builder.
[xudocci.git] / src / main / java / net / pterodactylus / irc / DefaultConnectionFactory.java
1 package net.pterodactylus.irc;
2
3 import javax.net.SocketFactory;
4
5 import com.google.common.eventbus.EventBus;
6
7 /**
8  * Default {@link ConnectionFactory} implementation that uses plain sockets to create connections.
9  *
10  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
11  */
12 public class DefaultConnectionFactory implements ConnectionFactory {
13
14         private final EventBus eventBus;
15
16         public DefaultConnectionFactory(EventBus eventBus) {
17                 this.eventBus = eventBus;
18         }
19
20         @Override
21         public Connection createConnection(String hostname, int port) {
22                 return new Connection(eventBus, SocketFactory.getDefault(), hostname, port);
23         }
24
25 }