Add support for port option
Add check to see if $self->{server} is defined before using it