Let $B$ be a standard brownian motion and let $T=\inf\{t\ge 0 \mid B_t\ge 1\}$. Now we have $E(B_0)=0$, but $ E(B_T)=1$, i.e. the optional sampling theorem can't be applied. The only issue could be that $T$ is not bounded, but actually it is, since $P(T<\infty)=1$ or where is the error? Any comments/help on this are welcome!
Theorem: Let $X$ adapted and right countinuous. Then $X$ is a martingale iff $E(X_T)=E(X_0)$ for all bounded stopping times $T$.