title: Socket is returning null when executing isConnected()
body: <p>I'm trying to connect to a socket and then check if it is connected. My problem is that my socket IS connecting but when I ask if it is, it returns null.</p>
  
  <p>How I'm getting my connection:</p>
  
  <pre><code>package main;
  
  import java.io.IOException;
  import java.net.Socket;
  
  public class getIrcConnection {
  
      String Server = "tmi.twitch.tv";
      int Port = 80;
  
      declars declars = new declars();
  
      public getIrcConnection() throws IOException{
  
      this.declars.socket = new Socket(Server, Port);
  
      }
  
  }
  </code></pre>
  
  <p>Where my socket is stored:</p>
  
  <pre><code>package main;
  
  import java.net.Socket;
  
  public class declars {
  
      Socket socket;
  
  }
  </code></pre>
  
  <p>How I'm checking the connection:</p>
  
  <pre><code>package main;
  
  
  public class checkIrcConnection {
  
      declars declars = new declars();
  
      public checkIrcConnection() {
  
          if (this.declars.socket.isConnected()) {           
          System.out.println("Connected");     
          }
  
        }
  
  }
  </code></pre>
  
  <p>All of this is beeing executed in the main method:</p>
  
  <pre><code>package main;
  
  public class Main {
  
      public static void main(String[] args) throws Exception {
  
          getIrcConnection gic = new getIrcConnection();
  
          checkIrcConnection cic = new checkIrcConnection();
  
      }
  
  }
  </code></pre>