public void connect(final String host, final int port) throws IOException {
        if (connected) {
            throw new IllegalStateException("Already connected");
        }

        if (this.hostPort == null) {
            this.hostPort = host + ":" + port;
        }

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Connecting to {}", this.hostPort);
        }

        this.socket = createSocket();
        this.socket.bind(this.bindpoint);
        this.socket.setSoTimeout(REPLY_TIMEOUT);
        this.socket.connect(new InetSocketAddress(host, port), CONNECT_TIMEOUT);

        try {
            this.bindpoint = this.socket.getLocalSocketAddress();

            this.reader = new BufferedReader(new InputStreamReader(this.socket.getInputStream()));

            this.rawOutput = this.socket.getOutputStream();
            this.dotTerminatedOutput = new DotTerminatedOutputStream(this.rawOutput);
            this.dataOutput = new ExtraDotOutputStream(this.dotTerminatedOutput);
            this.writer = new PrintWriter(this.rawOutput, true);
        } catch (final IOException e) {
            close();
            throw e;
        }

        connected = true;
    }
Establishes a connection to host and port.

@throws IOException if there is a problem connecting to the port
src/test/java/de/gessnerfl/fakesmtp/smtp/client/SMTPClient.java