java.net.SocketException: Software caused connection abort: recv failed
I am getting Error (java.net.SocketException: Software caused connection abort: recv failed) when bufferwriter flush() function is called.

      private void connect(String host, int port) {
      try {
          SSLSocketFactory sf = sslContext.getSocketFactory();
          SSLSocket socket = (SSLSocket) sf.createSocket(host, port);

          InputStream inputstream = System.in;
          InputStreamReader inputstreamreader = new InputStreamReader(inputstream);
          bufferedreader = new BufferedReader(inputstreamreader);

          OutputStream outputstream = socket.getOutputStream();
          OutputStreamWriter outputstreamwriter = new OutputStreamWriter(outputstream);
          bufferedwriter = new BufferedWriter(outputstreamwriter);

    } catch( GeneralSecurityException gse ) {
      gse.printStackTrace();
    } catch( IOException ie ) {
      ie.printStackTrace();
    }
    }
    
    public void run() {
    try {
     String string = null;
            while ((string = bufferedreader.readLine()) != null) {
                bufferedwriter.write(string + '\n');
                bufferedwriter.flush(); // after debugging here error occurs
            }
     } catch( IOException ie ) {
      ie.printStackTrace();
     }
    }
java.net.SocketException: Software caused connection abort: recv failed
===

I am getting Error (java.net.SocketException: Software caused connection abort: recv failed) when bufferwriter flush() function is called.

      private void connect(String host, int port) {
      try {
          SSLSocketFactory sf = sslContext.getSocketFactory();
          SSLSocket socket = (SSLSocket) sf.createSocket(host, port);

          InputStream inputstream = System.in;
          InputStreamReader inputstreamreader = new InputStreamReader(inputstream);
          bufferedreader = new BufferedReader(inputstreamreader);

          OutputStream outputstream = socket.getOutputStream();
          OutputStreamWriter outputstreamwriter = new OutputStreamWriter(outputstream);
          bufferedwriter = new BufferedWriter(outputstreamwriter);

    } catch( GeneralSecurityException gse ) {
      gse.printStackTrace();
    } catch( IOException ie ) {
      ie.printStackTrace();
    }
    }
    
    public void run() {
    try {
     String string = null;
            while ((string = bufferedreader.readLine()) != null) {
                bufferedwriter.write(string + '\n');
                bufferedwriter.flush(); // after debugging here error occurs
            }
     } catch( IOException ie ) {
      ie.printStackTrace();
     }
    }