Java SSLSocket error: cannot be referenced from non-static context
<p>I am struggling to see what is wrong in here (part of the class):</p>

<pre><code>public class Network implements Runnable {    
    private static Network cachedInstance;

    private static boolean connected;

    //private Socket clientSocket;
    private SSLSocket clientSocket;
    private PrintWriter out;
    private BufferedReader in;

    private Map&lt;String, SyncObject&gt; waitForServer;

    private Network(final String hostname, final int port) {
        try {
            Socket baseSocket = new Socket();
            baseSocket.connect(new InetSocketAddress(hostname, port), Config.TIMEOUT);
            clientSocket = (SSLSocket)SSLSocketFactory.createSocket(baseSocket, hostname, port, true);
            clientSocket.startHandshake();
            out = new PrintWriter(clientSocket.getOutputStream(), true);     
            in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
            connected = true;
        } catch (IOException ex) { 
            connected = false;
        }

        waitForServer = new HashMap&lt;&gt;();
    }
</code></pre>

<p>I get an error: </p>

<pre><code>C:\Users\Frank\Dropbox\NetbeansProjects\TradingCardGame\src\network\Network.java:47: error: non-static method createSocket(Socket,String,int,boolean) cannot be referenced from a static context
        clientSocket = (SSLSocket)SSLSocketFactory.createSocket(baseSocket, hostname, port, true);
</code></pre>

<p>How am I even being in a static context?</p>

<p>Regards.</p>
