title: BufferedWriter.write() does not seem to work
body: <p>I have two Java applications, where an Android client connects to a server on a computer and sends a message using BufferedWriter over websockets.</p>
  
  <p>The client:</p>
  
  <pre><code>    try {
          toast("Sending...");
          Socket sock = new Socket(ip, PORT);
          OutputStream os = sock.getOutputStream();
          BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os));
          bw.flush();
          bw.write("Hello Server!");
          toast("Connected!");
      } catch (UnknownHostException e) {
          toast(e.getMessage());
      } catch (IOException e) {
          toast(e.getMessage());
      }
  </code></pre>
  
  <p>The server:</p>
  
  <pre><code>public static void main(String[] args) {
      ServerSocket server;
      ConnectionThread ct;
      Socket s;
      ExecutorService es = Executors.newSingleThreadExecutor();
      try {
          System.out.println("Starting server...");
          server = new ServerSocket(1337);
          s = server.accept();
          ct = new ConnectionThread(s);
          es.execute(ct);
      } catch (IOException ex) {
          ex.printStackTrace();
      }       
  }
  </code></pre>
  
  <p>The <code>ConnectionThread</code> class:</p>
  
  <pre><code>public class ConnectionThread implements Runnable {
      private Socket sock;
      private InputStream is;
      private BufferedReader br;
      private boolean online;
      public ConnectionThread(Socket s) {
          System.out.println("Creating connection thread.");
          this.sock = s;
          online = true;
      }
      @Override
      public void run() {
          String input = "";
          try {
              System.out.println("Starting to read...");
              is = sock.getInputStream();
              br = new BufferedReader(new InputStreamReader(is));
  
              while (online) {
                  input = br.readLine();
                  if(input != null){
                      System.out.print("Received message: ");
                      System.out.println(input);
                  }
  
              }
  
              br.close();
              is.close();
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>When I run the server, and then the client, the client will show the "Connected!" toast, and the server's output will be:</p>
  
  <pre><code>Starting server...
  Creating connection thread.
  Starting to read...
  </code></pre>
  
  <p>So, it seems like the connection is actually being made, but the message does not arrive. Does anybody know why this could be happening?</p>